Skip to content

Commit a9bc955

Browse files
authored
Ensure screenshot taken on Mac has always correct size (#1676)
1 parent a27443a commit a9bc955

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/screenshot-window.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ export function createScreenshotWindow( captureUrl: string ) {
5858
const LOAD_TIMEOUT = process.platform === 'win32' ? 2000 : 500;
5959
await new Promise( ( resolve ) => setTimeout( resolve, LOAD_TIMEOUT ) );
6060

61-
return window.webContents.capturePage();
61+
// Force the window to the exact dimensions we want - in some cases, the window may not
62+
// respect the size set in the constructor, especially on macOS, where it might adjust
63+
// the size based on the content.
64+
window.setSize( SCREENSHOT_WIDTH, SCREENSHOT_HEIGHT );
65+
66+
return await window.webContents.capturePage();
6267
};
6368

6469
return { window, waitForCapture };

0 commit comments

Comments
 (0)