mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 20:52:06 +00:00
fix: Incorrect window size on multi-monitor scaled displays (#2302)
see discussion on th-ch#2258
This commit is contained in:
12
src/index.ts
12
src/index.ts
@ -321,9 +321,11 @@ async function createMainWindow() {
|
|||||||
const { x: windowX, y: windowY } = windowPosition;
|
const { x: windowX, y: windowY } = windowPosition;
|
||||||
const winSize = win.getSize();
|
const winSize = win.getSize();
|
||||||
const display = screen.getDisplayNearestPoint(windowPosition);
|
const display = screen.getDisplayNearestPoint(windowPosition);
|
||||||
|
const primaryDisplay = screen.getPrimaryDisplay();
|
||||||
|
|
||||||
const scaledWidth = windowSize.width;
|
const scaleFactor = is.windows() ? primaryDisplay.scaleFactor / display.scaleFactor : 1;
|
||||||
const scaledHeight = windowSize.height;
|
const scaledWidth = Math.floor(windowSize.width * scaleFactor);
|
||||||
|
const scaledHeight = Math.floor(windowSize.height * scaleFactor);
|
||||||
|
|
||||||
const scaledX = windowX;
|
const scaledX = windowX;
|
||||||
const scaledY = windowY;
|
const scaledY = windowY;
|
||||||
@ -339,9 +341,9 @@ async function createMainWindow() {
|
|||||||
console.warn(
|
console.warn(
|
||||||
LoggerPrefix,
|
LoggerPrefix,
|
||||||
t('main.console.window.tried-to-render-offscreen', {
|
t('main.console.window.tried-to-render-offscreen', {
|
||||||
winSize: String(winSize),
|
windowSize: String(winSize),
|
||||||
displaySize: String(display.bounds),
|
displaySize: JSON.stringify(display.bounds),
|
||||||
windowPosition: String(windowPosition),
|
position: JSON.stringify(windowPosition),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user