From cd4952cc7ba6467591c5e9f5b1b8cdb32549dd43 Mon Sep 17 00:00:00 2001 From: jdescottes Date: Sat, 2 Nov 2013 11:24:02 +0100 Subject: [PATCH] feature : zoom-level - Minimap usability : mouseup and mousemove events are now plugged on document.body instead of the minimap's controller. This way the user can move his mouse outside the container to keep moving the map's frame. Also the mouseup information is no longer lost if it occurs outside for the minimap. --- js/controller/MinimapController.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/controller/MinimapController.js b/js/controller/MinimapController.js index 8128790b..6b1fc892 100644 --- a/js/controller/MinimapController.js +++ b/js/controller/MinimapController.js @@ -11,13 +11,16 @@ }; ns.MinimapController.prototype.init = function () { + // Create minimap DOM elements this.cropFrame = document.createElement('DIV'); this.cropFrame.className = 'minimap-crop-frame'; this.cropFrame.style.display = 'none'; - $(this.container).mousedown(this.onMinimapMousedown_.bind(this)); - $(this.container).mousemove(this.onMinimapMousemove_.bind(this)); - $(this.container).mouseup(this.onMinimapMouseup_.bind(this)); $(this.container).append(this.cropFrame); + + // Init mouse events + $(this.container).mousedown(this.onMinimapMousedown_.bind(this)); + $('body').mousemove(this.onMinimapMousemove_.bind(this)); + $('body').mouseup(this.onMinimapMouseup_.bind(this)); }; ns.MinimapController.prototype.onDrawingControllerMove_ = function () {