Fix zoomFactor in webviews

Change-type: patch
Signed-off-by: Lorenzo Alberto Maria Ambrosi <lorenzothunder.ambrosi@gmail.com>
This commit is contained in:
Lorenzo Alberto Maria Ambrosi 2020-08-31 09:03:37 +02:00
parent 611e659626
commit 06997fdf29
3 changed files with 15 additions and 2 deletions

View File

@ -356,6 +356,16 @@ async function main() {
ReactDOM.render(
React.createElement(MainPage),
document.getElementById('main'),
// callback to set the correct zoomFactor for webviews as well
async () => {
const fullscreen = await settings.get('fullscreen');
const width = fullscreen ? window.screen.width : window.outerWidth;
try {
electron.webFrame.setZoomFactor(width / settings.DEFAULT_WIDTH);
} catch (err) {
// noop
}
},
);
}

View File

@ -26,6 +26,9 @@ const debug = _debug('etcher:models:settings');
const JSON_INDENT = 2;
export const DEFAULT_WIDTH = 800;
export const DEFAULT_HEIGHT = 480;
/**
* @summary Userdata directory path
* @description

View File

@ -122,8 +122,8 @@ interface AutoUpdaterConfig {
async function createMainWindow() {
const fullscreen = Boolean(await settings.get('fullscreen'));
const defaultWidth = 800;
const defaultHeight = 480;
const defaultWidth = settings.DEFAULT_WIDTH;
const defaultHeight = settings.DEFAULT_HEIGHT;
let width = defaultWidth;
let height = defaultHeight;
if (fullscreen) {