Fix electron downgrade

This commit is contained in:
Thomas Nordquist
2019-03-03 00:55:15 +01:00
parent 55dd79aebd
commit 91486718d8

View File

@@ -74,7 +74,7 @@ const editMenu: MenuItemConstructorOptions = {
], ],
} }
const viewMenu = { const viewMenu: MenuItemConstructorOptions = {
label: 'View', label: 'View',
submenu: [ submenu: [
{ {
@@ -93,8 +93,9 @@ const viewMenu = {
click: () => { click: () => {
const window = BrowserWindow.getFocusedWindow() const window = BrowserWindow.getFocusedWindow()
if (window) { if (window) {
const zoom = window.webContents.getZoomFactor() window.webContents.getZoomFactor((zoom) => {
window.webContents.setZoomFactor(Math.min(zoom + 0.1, 2.0)) window.webContents.setZoomFactor(Math.min(zoom + 0.1, 2.0))
})
} }
}, },
}, },
@@ -104,15 +105,16 @@ const viewMenu = {
click: () => { click: () => {
const window = BrowserWindow.getFocusedWindow() const window = BrowserWindow.getFocusedWindow()
if (window) { if (window) {
const zoom = window.webContents.getZoomFactor() window.webContents.getZoomFactor((zoom) => {
window.webContents.setZoomFactor(Math.max(zoom - 0.1, 0.5)) window.webContents.setZoomFactor(Math.max(zoom - 0.1, 0.5))
})
} }
}, },
}, },
], ],
} }
const template: Array<(MenuItemConstructorOptions) | (MenuItem)> = [ const template: any = [
applicationMenu, applicationMenu,
editMenu, editMenu,
viewMenu, viewMenu,