From 3170acf51684076cf8bed076fce95c08449b5716 Mon Sep 17 00:00:00 2001 From: Ramiro Saenz Date: Thu, 25 Aug 2016 09:32:50 -0300 Subject: [PATCH] Mouse Wheel zooming Related #217 --- app/Application.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/Application.js b/app/Application.js index 86408a8c..13696712 100644 --- a/app/Application.js +++ b/app/Application.js @@ -128,6 +128,22 @@ Ext.define('Rambox.Application', { ] }); + // Mouse Wheel zooming + document.addEventListener('mousewheel', function(e) { + if( e.ctrlKey ) { + var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail))); + + var tabPanel = Ext.cq1('app-main'); + if ( tabPanel.items.indexOf(tabPanel.getActiveTab()) === 0 ) return false; + + if ( delta === 1 ) { // Zoom In + tabPanel.getActiveTab().zoomIn(); + } else { // Zoom Out + tabPanel.getActiveTab().zoomOut(); + } + } + }); + if ( process.platform !== 'win32' ) { this.checkUpdate(true); }