was able to reproduce the wierd clicking bug jrf found. it was happening because the mouseup was not being properly handled by the toolbar buttons. this is taken care of.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1477 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -21,6 +21,9 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
|
||||
direction: "vertical",
|
||||
|
||||
/** @type String */
|
||||
buttonClicked: null,
|
||||
|
||||
initialize: function(position, direction) {
|
||||
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
||||
this.position = new OpenLayers.Pixel(OpenLayers.Control.MouseToolbar.X,
|
||||
@@ -63,9 +66,9 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
btn.activeImgLocation = activeImgLocation;
|
||||
|
||||
btn.events = new OpenLayers.Events(this, btn, null, true);
|
||||
btn.events.register("mousedown", this, this.buttonClick);
|
||||
btn.events.register("dblclick", this,
|
||||
OpenLayers.Util.safeStopPropagation);
|
||||
btn.events.register("mousedown", this, this.buttonDown);
|
||||
btn.events.register("mouseup", this, this.buttonUp);
|
||||
btn.events.register("dblclick", this, Event.stop);
|
||||
btn.action = id;
|
||||
btn.title = title;
|
||||
btn.alt = title;
|
||||
@@ -76,11 +79,28 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
return btn;
|
||||
},
|
||||
|
||||
buttonClick: function(evt) {
|
||||
/**
|
||||
* @param {Event} evt
|
||||
*/
|
||||
buttonDown: function(evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
this.switchModeTo(evt.element.action);
|
||||
this.buttonClicked = evt.element.action;
|
||||
Event.stop(evt);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Event} evt
|
||||
*/
|
||||
buttonUp: function(evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (this.buttonClicked != null) {
|
||||
if (this.buttonClicked == evt.element.action) {
|
||||
this.switchModeTo(evt.element.action);
|
||||
}
|
||||
Event.stop(evt);
|
||||
this.buttonClicked = null;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Event} evt
|
||||
@@ -179,6 +199,8 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
|
||||
switchModeTo: function(mode) {
|
||||
if (mode != this.mode) {
|
||||
|
||||
|
||||
if (this.mode && this.buttons[this.mode]) {
|
||||
OpenLayers.Util.modifyAlphaImageDiv(this.buttons[this.mode], null, null, null, this.buttons[this.mode].imgLocation);
|
||||
}
|
||||
@@ -195,6 +217,15 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
if (this.buttons[mode]) {
|
||||
OpenLayers.Util.modifyAlphaImageDiv(this.buttons[mode], null, null, null, this.buttons[mode].activeImgLocation);
|
||||
}
|
||||
switch (this.mode) {
|
||||
case "zoombox":
|
||||
this.map.div.style.cursor = "crosshair";
|
||||
break;
|
||||
default:
|
||||
this.map.div.style.cursor = "default";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@@ -254,6 +285,21 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
this.map.div.style.cursor = "default";
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Event} evt
|
||||
*/
|
||||
defaultMouseOut: function (evt) {
|
||||
if (this.mouseDragStart != null
|
||||
&& OpenLayers.Util.mouseLeft(evt, this.map.div)) {
|
||||
if (this.zoomBox) {
|
||||
this.removeZoomBox();
|
||||
if (this.startViaKeyboard) this.leaveMode();
|
||||
}
|
||||
this.mouseDragStart = null;
|
||||
this.map.div.style.cursor = "default";
|
||||
}
|
||||
},
|
||||
|
||||
defaultClick: function (evt) {
|
||||
if (this.performedDrag) {
|
||||
this.performedDrag = false;
|
||||
|
||||
Reference in New Issue
Block a user