in packages/app/client/src/ui/shell/appMenu/appMenuTemplate.ts [144:204]
private static get viewMenu(): MenuItem[] {
const maxZoomFactor = 3; // 300%
const minZoomFactor = 0.25; // 25%;
return [
{ label: 'Reset Zoom', onClick: () => remote.getCurrentWebContents().setZoomLevel(0), subtext: `${CtrlOrCmd}+0` },
{
label: 'Zoom In',
onClick: () => {
const webContents = remote.getCurrentWebContents();
const zoomFactor = webContents.getZoomFactor();
const newZoomFactor = zoomFactor + 0.1;
if (newZoomFactor >= maxZoomFactor) {
webContents.setZoomFactor(maxZoomFactor);
} else {
webContents.setZoomFactor(newZoomFactor);
}
},
subtext: `${CtrlOrCmd}+=`,
},
{
label: 'Zoom Out',
onClick: () => {
const webContents = remote.getCurrentWebContents();
const zoomFactor = webContents.getZoomFactor();
const newZoomFactor = zoomFactor - 0.1;
if (newZoomFactor <= minZoomFactor) {
webContents.setZoomFactor(minZoomFactor);
} else {
webContents.setZoomFactor(newZoomFactor);
}
},
subtext: `${CtrlOrCmd}+-`,
},
{ type: 'separator' },
{
label: 'Toggle Full Screen',
onClick: () => {
const currentWindow = remote.getCurrentWindow();
currentWindow.setFullScreen(!currentWindow.isFullScreen());
if (currentWindow.isFullScreen()) {
AppMenuTemplate.commandService.remoteCall(ShowMessageBox, null, {
message: 'Entering full screen.',
title: 'Full screen mode',
});
} else {
AppMenuTemplate.commandService.remoteCall(ShowMessageBox, null, {
message: 'Exiting full screen.',
title: 'Full screen mode',
});
}
},
subtext: 'F11',
},
{
label: 'Toggle Developer Tools',
onClick: () => remote.getCurrentWebContents().toggleDevTools(),
subtext: `${CtrlOrCmd}+Shift+I`,
},
];
}