diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Menu.js | 36 | ||||
-rw-r--r-- | src/stores/AppStore.js | 14 |
2 files changed, 42 insertions, 8 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index c378619ad..dce8ab969 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -239,16 +239,32 @@ const _templateFactory = intl => [ | |||
239 | }, | 239 | }, |
240 | { | 240 | { |
241 | label: intl.formatMessage(menuItems.resetZoom), | 241 | label: intl.formatMessage(menuItems.resetZoom), |
242 | role: 'resetzoom', | 242 | accelerator: 'Cmd+0', |
243 | click() { | ||
244 | getActiveWebview().setZoomLevel(0); | ||
245 | }, | ||
243 | }, | 246 | }, |
244 | { | 247 | { |
245 | label: intl.formatMessage(menuItems.zoomIn), | 248 | label: intl.formatMessage(menuItems.zoomIn), |
246 | // accelerator: 'Cmd+=', | 249 | accelerator: 'Cmd+plus', |
247 | role: 'zoomin', | 250 | click() { |
251 | const activeService = getActiveWebview(); | ||
252 | activeService.getZoomLevel((level) => { | ||
253 | // level 9 =~ +300% and setZoomLevel wouldnt zoom in further | ||
254 | if (level < 9) activeService.setZoomLevel(level + 1); | ||
255 | }); | ||
256 | }, | ||
248 | }, | 257 | }, |
249 | { | 258 | { |
250 | label: intl.formatMessage(menuItems.zoomOut), | 259 | label: intl.formatMessage(menuItems.zoomOut), |
251 | role: 'zoomout', | 260 | accelerator: 'Cmd+-', |
261 | click() { | ||
262 | const activeService = getActiveWebview(); | ||
263 | activeService.getZoomLevel((level) => { | ||
264 | // level -9 =~ -50% and setZoomLevel wouldnt zoom out further | ||
265 | if (level > -9) activeService.setZoomLevel(level - 1); | ||
266 | }); | ||
267 | }, | ||
252 | }, | 268 | }, |
253 | { | 269 | { |
254 | type: 'separator', | 270 | type: 'separator', |
@@ -394,8 +410,10 @@ const _titleBarTemplateFactory = intl => [ | |||
394 | label: intl.formatMessage(menuItems.zoomIn), | 410 | label: intl.formatMessage(menuItems.zoomIn), |
395 | accelerator: `${ctrlKey}+Plus`, | 411 | accelerator: `${ctrlKey}+Plus`, |
396 | click() { | 412 | click() { |
397 | getActiveWebview().getZoomLevel((zoomLevel) => { | 413 | const activeService = getActiveWebview(); |
398 | getActiveWebview().setZoomLevel(zoomLevel === 5 ? zoomLevel : zoomLevel + 1); | 414 | activeService.getZoomLevel((level) => { |
415 | // level 9 =~ +300% and setZoomLevel wouldnt zoom in further | ||
416 | if (level < 9) activeService.setZoomLevel(level + 1); | ||
399 | }); | 417 | }); |
400 | }, | 418 | }, |
401 | }, | 419 | }, |
@@ -403,8 +421,10 @@ const _titleBarTemplateFactory = intl => [ | |||
403 | label: intl.formatMessage(menuItems.zoomOut), | 421 | label: intl.formatMessage(menuItems.zoomOut), |
404 | accelerator: `${ctrlKey}+-`, | 422 | accelerator: `${ctrlKey}+-`, |
405 | click() { | 423 | click() { |
406 | getActiveWebview().getZoomLevel((zoomLevel) => { | 424 | const activeService = getActiveWebview(); |
407 | getActiveWebview().setZoomLevel(zoomLevel === -5 ? zoomLevel : zoomLevel - 1); | 425 | activeService.getZoomLevel((level) => { |
426 | // level -9 =~ -50% and setZoomLevel wouldnt zoom out further | ||
427 | if (level > -9) activeService.setZoomLevel(level - 1); | ||
408 | }); | 428 | }); |
409 | }, | 429 | }, |
410 | }, | 430 | }, |
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index f9009af5a..d933ca407 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -178,6 +178,20 @@ export default class AppStore extends Store { | |||
178 | }, | 178 | }, |
179 | ); | 179 | ); |
180 | 180 | ||
181 | // We need to add an additional key listener for ctrl+ on windows. Otherwise only ctrl+shift+ would work | ||
182 | if (isWindows) { | ||
183 | key( | ||
184 | 'ctrl+=', () => { | ||
185 | debug('Windows: zoom in via ctrl+'); | ||
186 | const { webview } = this.stores.services.active; | ||
187 | webview.getZoomLevel((level) => { | ||
188 | // level 9 =~ +300% and setZoomLevel wouldnt zoom in further | ||
189 | if (level < 9) webview.setZoomLevel(level + 1); | ||
190 | }); | ||
191 | }, | ||
192 | ); | ||
193 | } | ||
194 | |||
181 | this.locale = this._getDefaultLocale(); | 195 | this.locale = this._getDefaultLocale(); |
182 | 196 | ||
183 | this._healthCheck(); | 197 | this._healthCheck(); |