diff --git a/lib/OpenLayers/Control/MouseToolbar.js b/lib/OpenLayers/Control/MouseToolbar.js index 25218592e2..293c9785e0 100644 --- a/lib/OpenLayers/Control/MouseToolbar.js +++ b/lib/OpenLayers/Control/MouseToolbar.js @@ -48,7 +48,6 @@ OpenLayers.Control.MouseToolbar.prototype = this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz, "Drag the map to pan."); centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0)); this.switchModeTo("pan"); - this.map.events.register("zoomend", this, function() { this.switchModeTo("pan"); }); return this.div; }, @@ -105,8 +104,10 @@ OpenLayers.Control.MouseToolbar.prototype = if (!Event.isLeftClick(evt)) return; this.mouseDragStart = evt.xy.clone(); this.performedDrag = false; + this.startViaKeyboard = false; if (evt.shiftKey && this.mode !="zoombox") { this.switchModeTo("zoombox"); + this.startViaKeyboard = true; } else if (evt.altKey && this.mode !="measure") { this.switchModeTo("measure"); } else if (!this.mode) { @@ -239,10 +240,6 @@ OpenLayers.Control.MouseToolbar.prototype = if (!Event.isLeftClick(evt)) return; switch (this.mode) { case "zoombox": - console.log(this.mouseDragStart, evt.xy); - console.log(Math.abs(this.mouseDragStart.x - evt.xy.x) > 5 || Math.abs((this.mouseDragStart.y - evt.xy.y)) > 5); - console.log(Math.abs(this.mouseDragStart.x-evt.xy.x) > 5); - console.log(Math.abs(this.mouseDragStart.y-evt.xy.y)>5); if (Math.abs(this.mouseDragStart.x - evt.xy.x) > 5 || Math.abs(this.mouseDragStart.y - evt.xy.y) > 5) { var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart ); @@ -260,7 +257,8 @@ OpenLayers.Control.MouseToolbar.prototype = } this.map.viewPortDiv.removeChild(document.getElementById("zoomBox")); this.zoomBox = null; - this.leaveMode(); + console.log(this.startViaKeyboard); + if (this.startViaKeyboard) this.leaveMode(); break; case "pan": if (this.performedDrag) {