mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-23 02:28:55 +00:00
... by using setZoomFactor instead of sending change-zoom event.
This commit is contained in:
parent
574205ab0d
commit
454ab1e7bd
@ -102,20 +102,18 @@ function createMainWindow(inpOptions, onAppQuit, setDockBadge) {
|
||||
fs.writeFileSync(path.join(__dirname, '..', 'nativefier.json'), JSON.stringify(options));
|
||||
}
|
||||
|
||||
let currentZoom = options.zoom;
|
||||
|
||||
const onZoomIn = () => {
|
||||
currentZoom += ZOOM_INTERVAL;
|
||||
mainWindow.webContents.send('change-zoom', currentZoom);
|
||||
const adjustWindowZoom = (window, adjustment) => {
|
||||
window.webContents.getZoomFactor((zoomFactor) => {
|
||||
window.webContents.setZoomFactor(zoomFactor + adjustment);
|
||||
});
|
||||
};
|
||||
|
||||
const onZoomOut = () => {
|
||||
currentZoom -= ZOOM_INTERVAL;
|
||||
mainWindow.webContents.send('change-zoom', currentZoom);
|
||||
};
|
||||
const onZoomIn = () => adjustWindowZoom(mainWindow, ZOOM_INTERVAL);
|
||||
|
||||
const onZoomOut = () => adjustWindowZoom(mainWindow, -ZOOM_INTERVAL);
|
||||
|
||||
const onZoomReset = () => {
|
||||
mainWindow.webContents.send('change-zoom', options.zoom);
|
||||
mainWindow.webContents.setZoomFactor(options.zoom);
|
||||
};
|
||||
|
||||
const clearAppData = () => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
Preload file that will be executed in the renderer process
|
||||
*/
|
||||
import { ipcRenderer, webFrame } from 'electron';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
@ -78,7 +78,3 @@ ipcRenderer.on('debug', (event, message) => {
|
||||
// eslint-disable-next-line no-console
|
||||
log.info('debug:', message);
|
||||
});
|
||||
|
||||
ipcRenderer.on('change-zoom', (event, message) => {
|
||||
webFrame.setZoomFactor(message);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user