diff --git a/lib/OpenLayers/Control/MouseDefaults.js b/lib/OpenLayers/Control/MouseDefaults.js index d48386ec51..2643f117e5 100644 --- a/lib/OpenLayers/Control/MouseDefaults.js +++ b/lib/OpenLayers/Control/MouseDefaults.js @@ -51,15 +51,6 @@ OpenLayers.Control.MouseDefaults.prototype = defaultMouseMove: function (evt) { if (this.mouseDragStart != null) { if (this.zoomBox) { - /* after initially suggesting it, I'm not so sure - * this is a good idea ... - * I always let up off the shift key too early - * and cancel my zoombox by accident - SDE - if (!evt.shiftKey) { - this.defaultMouseUp(evt); - return; - } - */ var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x); var deltaY = Math.abs(this.mouseDragStart.y - evt.xy.y); this.zoomBox.style.width = deltaX+"px"; @@ -88,20 +79,18 @@ OpenLayers.Control.MouseDefaults.prototype = */ defaultMouseUp: function (evt) { if (this.zoomBox) { - if (evt.shiftKey) { - var start = this.map.getLonLatFromPixel( this.mouseDragStart ); - var end = this.map.getLonLatFromPixel( evt.xy ); - var top = Math.max(start.lat, end.lat); - var bottom = Math.min(start.lat, end.lat); - var left = Math.min(start.lon, end.lon); - var right = Math.max(start.lon, end.lon); - var bounds = new OpenLayers.Bounds(left, bottom, right, top); - var zoom = this.map.getZoomForExtent(bounds); - this.map.setCenter(new OpenLayers.LonLat( - (start.lon + end.lon) / 2, - (start.lat + end.lat) / 2 - ), zoom); - } + var start = this.map.getLonLatFromPixel( this.mouseDragStart ); + var end = this.map.getLonLatFromPixel( evt.xy ); + var top = Math.max(start.lat, end.lat); + var bottom = Math.min(start.lat, end.lat); + var left = Math.min(start.lon, end.lon); + var right = Math.max(start.lon, end.lon); + var bounds = new OpenLayers.Bounds(left, bottom, right, top); + var zoom = this.map.getZoomForExtent(bounds); + this.map.setCenter(new OpenLayers.LonLat( + (start.lon + end.lon) / 2, + (start.lat + end.lat) / 2 + ), zoom); this.map.viewPortDiv.removeChild(document.getElementById("zoomBox")); this.zoomBox = null; }