From c38874b3745030f20fadeecec3f517ed70e9b134 Mon Sep 17 00:00:00 2001 From: euzuro Date: Fri, 15 Sep 2006 19:07:57 +0000 Subject: [PATCH] make it such that the map is dropped and the zoom box abandoned if the mouse goes off the screen. obviously the better solution would be to treat things as if we were still in the div -- mach 2 had this functionality. for now, however, we dont have time to code that, so i have created a ticket #263 and put it in the drawer for 2.2. this fix at least gives the user consistent behaviour, and does not allow for this annoying zooming with the zoom rectangle on mouseout. git-svn-id: http://svn.openlayers.org/trunk/openlayers@1474 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/MouseDefaults.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/OpenLayers/Control/MouseDefaults.js b/lib/OpenLayers/Control/MouseDefaults.js index c453052272..9f2b6e65cc 100644 --- a/lib/OpenLayers/Control/MouseDefaults.js +++ b/lib/OpenLayers/Control/MouseDefaults.js @@ -143,7 +143,10 @@ OpenLayers.Control.MouseDefaults.prototype = defaultMouseOut: function (evt) { if (this.mouseDragStart != null && OpenLayers.Util.mouseLeft(evt, this.map.div)) { - this.defaultMouseUp(evt); + if (this.zoomBox) { + this.removeZoomBox(); + } + this.mouseDragStart = null; } }, @@ -188,9 +191,16 @@ OpenLayers.Control.MouseDefaults.prototype = (end.lat) ), this.map.getZoom() + 1); } - this.map.viewPortDiv.removeChild(this.zoomBox); - this.zoomBox = null; - } + this.removeZoomBox(); + } + }, + + /** + * Remove the zoombox from the screen and nullify our reference to it. + */ + removeZoomBox: function() { + this.map.viewPortDiv.removeChild(this.zoomBox); + this.zoomBox = null; },