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));
|
fs.writeFileSync(path.join(__dirname, '..', 'nativefier.json'), JSON.stringify(options));
|
||||||
}
|
}
|
||||||
|
|
||||||
let currentZoom = options.zoom;
|
const adjustWindowZoom = (window, adjustment) => {
|
||||||
|
window.webContents.getZoomFactor((zoomFactor) => {
|
||||||
const onZoomIn = () => {
|
window.webContents.setZoomFactor(zoomFactor + adjustment);
|
||||||
currentZoom += ZOOM_INTERVAL;
|
});
|
||||||
mainWindow.webContents.send('change-zoom', currentZoom);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onZoomOut = () => {
|
const onZoomIn = () => adjustWindowZoom(mainWindow, ZOOM_INTERVAL);
|
||||||
currentZoom -= ZOOM_INTERVAL;
|
|
||||||
mainWindow.webContents.send('change-zoom', currentZoom);
|
const onZoomOut = () => adjustWindowZoom(mainWindow, -ZOOM_INTERVAL);
|
||||||
};
|
|
||||||
|
|
||||||
const onZoomReset = () => {
|
const onZoomReset = () => {
|
||||||
mainWindow.webContents.send('change-zoom', options.zoom);
|
mainWindow.webContents.setZoomFactor(options.zoom);
|
||||||
};
|
};
|
||||||
|
|
||||||
const clearAppData = () => {
|
const clearAppData = () => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
Preload file that will be executed in the renderer process
|
Preload file that will be executed in the renderer process
|
||||||
*/
|
*/
|
||||||
import { ipcRenderer, webFrame } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
@ -78,7 +78,3 @@ ipcRenderer.on('debug', (event, message) => {
|
|||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
log.info('debug:', message);
|
log.info('debug:', message);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.on('change-zoom', (event, message) => {
|
|
||||||
webFrame.setZoomFactor(message);
|
|
||||||
});
|
|
||||||
|
Loading…
Reference in New Issue
Block a user