If we choose to switch to a mode via the toolbar, don't leave that mode
until we're explicitly told to. This allows users to click the zoombox and zoom several times. git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1347 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user