Add zooming commands to menu (default app)
This commit is contained in:
parent
84bb82866d
commit
2e043453c0
1 changed files with 34 additions and 0 deletions
|
@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue