Don't let button controls interfer with handlers.

This change involves removal of the map's eventsDiv and introduces an OpenLayers.Events.buttonclick component that adds a buttonclick event which makes sure that only events that are not related to clicking a button propagate. This allows button controls to be on the map's viewPortDiv again.
This commit is contained in:
ahocevar
2012-01-20 03:37:11 +01:00
parent e68acfe91a
commit 05de2b5109
22 changed files with 520 additions and 224 deletions

View File

@@ -1202,7 +1202,7 @@ OpenLayers.Control.MouseDefaults = OpenLayers.Class(OpenLayers.Control, {
this.zoomBox.style.opacity = "0.50";
this.zoomBox.style.fontSize = "1px";
this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
this.map.eventsDiv.appendChild(this.zoomBox);
this.map.viewPortDiv.appendChild(this.zoomBox);
}
document.onselectstart = OpenLayers.Function.False;
OpenLayers.Event.stop(evt);
@@ -1275,7 +1275,7 @@ OpenLayers.Control.MouseDefaults = OpenLayers.Class(OpenLayers.Control, {
*/
defaultMouseOut: function (evt) {
if (this.mouseDragStart != null &&
OpenLayers.Util.mouseLeft(evt, this.map.eventsDiv)) {
OpenLayers.Util.mouseLeft(evt, this.map.viewPortDiv)) {
if (this.zoomBox) {
this.removeZoomBox();
}
@@ -1339,7 +1339,7 @@ OpenLayers.Control.MouseDefaults = OpenLayers.Class(OpenLayers.Control, {
* Remove the zoombox from the screen and nullify our reference to it.
*/
removeZoomBox: function() {
this.map.eventsDiv.removeChild(this.zoomBox);
this.map.viewPortDiv.removeChild(this.zoomBox);
this.zoomBox = null;
},
@@ -1602,7 +1602,7 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class(
this.zoomBox.style.opacity = "0.50";
this.zoomBox.style.fontSize = "1px";
this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1;
this.map.eventsDiv.appendChild(this.zoomBox);
this.map.viewPortDiv.appendChild(this.zoomBox);
this.performedDrag = true;
break;
case "measure":
@@ -1769,7 +1769,7 @@ OpenLayers.Control.MouseToolbar = OpenLayers.Class(
*/
defaultMouseOut: function (evt) {
if (this.mouseDragStart != null
&& OpenLayers.Util.mouseLeft(evt, this.map.eventsDiv)) {
&& OpenLayers.Util.mouseLeft(evt, this.map.viewPortDiv)) {
if (this.zoomBox) {
this.removeZoomBox();
if (this.startViaKeyboard) {