From 6a1484b49d7cf6a38a80276aef774f41c81d710e Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Wed, 14 Mar 2012 23:37:54 -0300 Subject: [PATCH] Minor fix to have a single point of exit. --- mindplot/src/main/javascript/Designer.js | 29 ++++++++++++------------ 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index b742d73d..5661d349 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -118,21 +118,22 @@ mindplot.Designer = new Class({ $(document).addEvent('mousewheel', function(event) { - var containerCoords = screenManager.getContainer().getCoordinates(); - if (event.client.y < containerCoords.top || - event.client.y > containerCoords.bottom || - event.client.x < containerCoords.left || - event.client.x > containerCoords.right - ) { - return true; - } + // Change mousewheel handling so we let the default + //event happen if we are outside the container. + var coords = screenManager.getContainer().getCoordinates(); + var isOutsideContainer = event.client.y < coords.top || + event.client.y > coords.bottom || + event.client.x < coords.left || + event.client.x > coords.right; - event.preventDefault(); - if (event.wheel > 0) { - this.zoomIn(1.05); - } - else { - this.zoomOut(1.05); + if (!isOutsideContainer) { + if (event.wheel > 0) { + this.zoomIn(1.05); + } + else { + this.zoomOut(1.05); + } + event.preventDefault(); } }.bind(this));