mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-11-04 20:38:03 +00:00
parent
dc0e6cb68f
commit
a6c1dcf952
@ -38,7 +38,7 @@ describe('generateMenu', () => {
|
||||
const menu = generateMenu(
|
||||
{
|
||||
nativefierVersion: '1.0.0',
|
||||
zoomBuildTimeValue: 1.0,
|
||||
zoom: 1.0,
|
||||
disableDevTools: false,
|
||||
},
|
||||
window,
|
||||
@ -65,7 +65,7 @@ describe('generateMenu', () => {
|
||||
const menu = generateMenu(
|
||||
{
|
||||
nativefierVersion: '1.0.0',
|
||||
zoomBuildTimeValue: 1.0,
|
||||
zoom: 1.0,
|
||||
disableDevTools: false,
|
||||
},
|
||||
window,
|
||||
@ -95,7 +95,7 @@ describe('generateMenu', () => {
|
||||
const menu = generateMenu(
|
||||
{
|
||||
nativefierVersion: '1.0.0',
|
||||
zoomBuildTimeValue: 1.0,
|
||||
zoom: 1.0,
|
||||
disableDevTools: false,
|
||||
},
|
||||
window,
|
||||
@ -131,7 +131,7 @@ describe('generateMenu', () => {
|
||||
const menu = generateMenu(
|
||||
{
|
||||
nativefierVersion: '1.0.0',
|
||||
zoomBuildTimeValue: 1.0,
|
||||
zoom: 1.0,
|
||||
disableDevTools: false,
|
||||
},
|
||||
window,
|
||||
|
@ -54,11 +54,11 @@ export function generateMenu(
|
||||
options,
|
||||
mainWindow: BrowserWindow,
|
||||
): MenuItemConstructorOptions[] {
|
||||
const { nativefierVersion, zoomBuildTimeValue, disableDevTools } = options;
|
||||
const { nativefierVersion, zoom, disableDevTools } = options;
|
||||
const zoomResetLabel =
|
||||
zoomBuildTimeValue === 1.0
|
||||
!zoom || zoom === 1.0
|
||||
? 'Reset Zoom'
|
||||
: `Reset Zoom (to ${zoomBuildTimeValue * 100}%, set at build time)`;
|
||||
: `Reset Zoom (to ${(zoom * 100).toFixed(1)}%, set at build time)`;
|
||||
|
||||
const editMenu: MenuItemConstructorOptions = {
|
||||
label: '&Edit',
|
||||
@ -210,14 +210,14 @@ export function generateMenu(
|
||||
{
|
||||
label: zoomResetLabel,
|
||||
accelerator: 'CmdOrCtrl+0',
|
||||
click: zoomReset,
|
||||
click: (): void => zoomReset(options),
|
||||
},
|
||||
{
|
||||
label: 'ZoomResetAdditionalShortcut',
|
||||
visible: false,
|
||||
acceleratorWorksWhenHidden: true,
|
||||
accelerator: 'CmdOrCtrl+num0',
|
||||
click: zoomReset,
|
||||
click: (): void => zoomReset(options),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {
|
||||
dialog,
|
||||
BrowserWindow,
|
||||
BrowserWindowConstructorOptions,
|
||||
dialog,
|
||||
HeadersReceivedResponse,
|
||||
IpcMainEvent,
|
||||
MessageBoxReturnValue,
|
||||
@ -331,7 +331,7 @@ export function zoomOut(): void {
|
||||
export function zoomReset(options): void {
|
||||
log.debug('zoomReset');
|
||||
withFocusedWindow((focusedWindow) => {
|
||||
focusedWindow.webContents.zoomFactor = options.zoom;
|
||||
focusedWindow.webContents.zoomFactor = options.zoom ?? 1.0;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user