Add zooming commands to menu (default app)

This commit is contained in:
Milan Burda 2016-08-01 15:41:13 +02:00
parent 84bb82866d
commit 2e043453c0

View file

@ -99,6 +99,40 @@ app.once('ready', () => {
click (item, focusedWindow) {
if (focusedWindow) focusedWindow.toggleDevTools()
}
},
{
type: 'separator'
},
{
label: 'Actual Size',
accelerator: 'CmdOrCtrl+0',
click (item, focusedWindow) {
if (focusedWindow) focusedWindow.webContents.setZoomLevel(0)
}
},
{
label: 'Zoom In',
accelerator: 'CmdOrCtrl+Plus',
click (item, focusedWindow) {
if (focusedWindow) {
const {webContents} = focusedWindow
webContents.getZoomLevel((zoomLevel) => {
webContents.setZoomLevel(zoomLevel + 0.5)
})
}
}
},
{
label: 'Zoom Out',
accelerator: 'CmdOrCtrl+-',
click (item, focusedWindow) {
if (focusedWindow) {
const {webContents} = focusedWindow
webContents.getZoomLevel((zoomLevel) => {
webContents.setZoomLevel(zoomLevel - 0.5)
})
}
}
}
]
},