From 1e197c770752c9d7b75b9abaead84426f1989cda Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Mon, 8 Jan 2024 09:49:38 +0000 Subject: [PATCH] Correctly set visual Zoom limits for Electron --- preload.cjs | 7 ++++--- www/js/app.js | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/preload.cjs b/preload.cjs index ba9a74ac..244c94d1 100644 --- a/preload.cjs +++ b/preload.cjs @@ -38,6 +38,10 @@ contextBridge.exposeInMainWorld('electronAPI', { openExternal: function (url) { ipcRenderer.send('open-external', url); }, + setZoomLimits: function (min, max) { + console.log('Setting zoom limits to ' + min + ' and ' + max); + webFrame.setVisualZoomLevelLimits(min, max); + }, isMicrosoftStoreApp: process.windowsStore && regexpInstalledFromMicrosoftStore.test(__dirname), __dirname: __dirname, on: function (event, callback) { @@ -63,9 +67,6 @@ contextBridge.exposeInMainWorld('dialog', { } }); -// Enable pinch-to-zoom -webFrame.setVisualZoomLevelLimits(1, 3); - // window.Buffer = Buffer; // console.log(win.session.cookies); diff --git a/www/js/app.js b/www/js/app.js index 8f58a8ee..f48af336 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -1822,6 +1822,8 @@ if (window.electronAPI) { }, 250); } }); + // Set the Zoom values for the window + electronAPI.setZoomLimits(1, 3); } document.getElementById('disableDragAndDropCheck').addEventListener('change', function () { params.disableDragAndDrop = this.checked;