Correctly set visual Zoom limits for Electron

This commit is contained in:
Jaifroid 2024-01-08 09:49:38 +00:00
parent 80ddc9c6e9
commit 1e197c7707
2 changed files with 6 additions and 3 deletions

View File

@ -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);

View File

@ -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;