Use zoomFactor to scale contents in fullscreen mode

Change-type: patch
Changelog-entry: Use zoomFactor to scale contents in fullscreen mode
This commit is contained in:
Lorenzo Alberto Maria Ambrosi 2020-03-13 10:31:12 +01:00 committed by Alexis Svinartchouk
parent 8b2f06442a
commit 4ee83d9da4

View File

@ -58,9 +58,16 @@ async function checkForUpdates(interval: number) {
function createMainWindow() {
const fullscreen = Boolean(settings.get('fullscreen'));
const defaultWidth = 800;
const defaultHeight = 480;
let width = defaultWidth;
let height = defaultHeight;
if (fullscreen) {
({ width, height } = electron.screen.getPrimaryDisplay().bounds);
}
const mainWindow = new electron.BrowserWindow({
width: parseInt(settings.get('width'), 10) || 800,
height: parseInt(settings.get('height'), 10) || 480,
width,
height,
frame: !fullscreen,
useContentSize: false,
show: false,
@ -77,10 +84,12 @@ function createMainWindow() {
backgroundThrottling: false,
nodeIntegration: true,
webviewTag: true,
zoomFactor: width / defaultWidth,
},
});
buildWindowMenu(mainWindow);
mainWindow.setFullScreen(true);
// Prevent flash of white when starting the application
mainWindow.on('ready-to-show', () => {