Skip to content

Commit

Permalink
fix(Service): Fix service zoom (cmd/ctrl+ & cmd/ctrl-)
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikGuzei committed Mar 5, 2019
1 parent 532171b commit 91a0f59
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -2,6 +2,7 @@ node_modules
flow-typed flow-typed
out out
.DS_Store .DS_Store
.idea
build build
.tmp .tmp
.stage .stage
Expand Down
28 changes: 24 additions & 4 deletions src/lib/Menu.js
Expand Up @@ -239,16 +239,36 @@ const _templateFactory = intl => [
}, },
{ {
label: intl.formatMessage(menuItems.resetZoom), label: intl.formatMessage(menuItems.resetZoom),
role: 'resetzoom', accelerator: 'Cmd+0',
click() {
getActiveWebview().setZoomLevel(0);
},
}, },
{ {
label: intl.formatMessage(menuItems.zoomIn), label: intl.formatMessage(menuItems.zoomIn),
// accelerator: 'Cmd+=', accelerator: 'Cmd+plus',
role: 'zoomin', click() {
const activeService = getActiveWebview();
activeService.getZoomLevel((level) => {
// level 9 =~ +300% and setZoomLevel wouldnt zoom in further
if (level < 9) {
activeService.setZoomLevel(level + 1);
}
});
},
}, },
{ {
label: intl.formatMessage(menuItems.zoomOut), label: intl.formatMessage(menuItems.zoomOut),
role: 'zoomout', accelerator: 'Cmd+-',
click() {
const activeService = getActiveWebview();
activeService.getZoomLevel((level) => {
// level -9 =~ -50% and setZoomLevel wouldnt zoom out further
if (level > -9) {
activeService.setZoomLevel(level - 1);
}
});
},
}, },
{ {
type: 'separator', type: 'separator',
Expand Down

0 comments on commit 91a0f59

Please sign in to comment.