From eb788aaf435844e6dcb3e9e330e330650b3770da Mon Sep 17 00:00:00 2001 From: Anton Nikolaev Date: Thu, 27 May 2021 08:49:33 -0700 Subject: [PATCH] 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 --- desktop/app/src/MenuBar.tsx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/desktop/app/src/MenuBar.tsx b/desktop/app/src/MenuBar.tsx index 13244aa34..f41d89945 100644 --- a/desktop/app/src/MenuBar.tsx +++ b/desktop/app/src/MenuBar.tsx @@ -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 () {