Added "Zoom in", "Zoom out" and "Actual size" commands similarly to Google Chrome

Summary: Changelog: allow zooming Flipper window content in and out either using View menu or hotkeys (Cmd+Plus) and (Cmd+Minus)

Reviewed By: passy

Differential Revision: D28748567

fbshipit-source-id: a214c708cae2c82d04eb53fc879518a0106517de
This commit is contained in:
Anton Nikolaev
2021-05-27 08:49:33 -07:00
committed by Facebook GitHub Bot
parent 6d1cecdeee
commit eb788aaf43

View File

@@ -33,6 +33,7 @@ import {
} from 'flipper-plugin';
import {StyleGuide} from './sandy-chrome/StyleGuide';
import {showEmulatorLauncher} from './sandy-chrome/appinspect/LaunchEmulator';
import {webFrame} from 'electron';
export type DefaultKeyboardAction = keyof typeof _buildInMenuEntries;
export type TopLevelMenu = 'Edit' | 'View' | 'Window' | 'Help';
@@ -320,6 +321,33 @@ function getTemplate(
}
},
},
{
label: 'Actual Size',
accelerator: (function () {
return 'CmdOrCtrl+0';
})(),
click: function (_, _focusedWindow: electron.BrowserWindow | undefined) {
webFrame.setZoomFactor(1);
},
},
{
label: 'Zoom In',
accelerator: (function () {
return 'CmdOrCtrl+=';
})(),
click: function (_, _focusedWindow: electron.BrowserWindow | undefined) {
webFrame.setZoomFactor(webFrame.getZoomFactor() + 0.25);
},
},
{
label: 'Zoom Out',
accelerator: (function () {
return 'CmdOrCtrl+-';
})(),
click: function (_, _focusedWindow: electron.BrowserWindow | undefined) {
webFrame.setZoomFactor(webFrame.getZoomFactor() - 0.25);
},
},
{
label: 'Manage Plugins...',
click: function () {