Check return values from activate()/deactivate() in subclassed Handlers and Controls, as appropriate. Fixes #599.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2955 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -34,20 +34,28 @@ OpenLayers.Control.Panel.prototype =
|
|||||||
},
|
},
|
||||||
|
|
||||||
activate: function() {
|
activate: function() {
|
||||||
OpenLayers.Control.prototype.activate.apply(this, arguments);
|
if (OpenLayers.Control.prototype.activate.apply(this, arguments)) {
|
||||||
for(var i = 0; i < this.controls.length; i++) {
|
for(var i = 0; i < this.controls.length; i++) {
|
||||||
if (this.controls[i] == this.defaultControl) {
|
if (this.controls[i] == this.defaultControl) {
|
||||||
this.controls[i].activate();
|
this.controls[i].activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.redraw();
|
this.redraw();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
deactivate: function() {
|
deactivate: function() {
|
||||||
OpenLayers.Control.prototype.deactivate.apply(this, arguments);
|
if (OpenLayers.Control.prototype.deactivate.apply(this, arguments)) {
|
||||||
for(var i = 0; i < this.controls.length; i++) {
|
for(var i = 0; i < this.controls.length; i++) {
|
||||||
this.controls[i].deactivate();
|
this.controls[i].deactivate();
|
||||||
}
|
}
|
||||||
this.redraw();
|
this.redraw();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -113,13 +113,21 @@ OpenLayers.Handler.Box.prototype = OpenLayers.Class.inherit( OpenLayers.Handler,
|
|||||||
},
|
},
|
||||||
|
|
||||||
activate: function () {
|
activate: function () {
|
||||||
OpenLayers.Handler.prototype.activate.apply(this, arguments);
|
if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
|
||||||
this.dragHandler.activate();
|
this.dragHandler.activate();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
deactivate: function () {
|
deactivate: function () {
|
||||||
OpenLayers.Handler.prototype.deactivate.apply(this, arguments);
|
if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
|
||||||
this.dragHandler.deactivate();
|
this.dragHandler.deactivate();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
CLASS_NAME: "OpenLayers.Handler.Box"
|
CLASS_NAME: "OpenLayers.Handler.Box"
|
||||||
|
|||||||
@@ -42,18 +42,26 @@ OpenLayers.Handler.Keyboard.prototype = OpenLayers.Class.inherit( OpenLayers.Han
|
|||||||
},
|
},
|
||||||
|
|
||||||
activate: function() {
|
activate: function() {
|
||||||
OpenLayers.Handler.prototype.activate.apply(this, arguments);
|
if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
|
||||||
for (var i = 0; i < this.KEY_EVENTS.length; i++) {
|
for (var i = 0; i < this.KEY_EVENTS.length; i++) {
|
||||||
OpenLayers.Event.observe(
|
OpenLayers.Event.observe(
|
||||||
window, this.KEY_EVENTS[i], this.eventListener);
|
window, this.KEY_EVENTS[i], this.eventListener);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
deactivate: function() {
|
deactivate: function() {
|
||||||
OpenLayers.Handler.prototype.activate.apply(this, arguments);
|
if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
|
||||||
for (var i = 0; i < this.KEY_EVENTS.length; i++) {
|
for (var i = 0; i < this.KEY_EVENTS.length; i++) {
|
||||||
OpenLayers.Event.stopObserving(
|
OpenLayers.Event.stopObserving(
|
||||||
document, this.KEY_EVENTS[i], this.eventListener);
|
document, this.KEY_EVENTS[i], this.eventListener);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -103,21 +103,29 @@ OpenLayers.Handler.MouseWheel.prototype = OpenLayers.Class.inherit( OpenLayers.H
|
|||||||
},
|
},
|
||||||
|
|
||||||
activate: function (evt) {
|
activate: function (evt) {
|
||||||
OpenLayers.Handler.prototype.activate.apply(this, arguments);
|
if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
|
||||||
//register mousewheel events specifically on the window and document
|
//register mousewheel events specifically on the window and document
|
||||||
var wheelListener = this.wheelListener;
|
var wheelListener = this.wheelListener;
|
||||||
OpenLayers.Event.observe(window, "DOMMouseScroll", wheelListener);
|
OpenLayers.Event.observe(window, "DOMMouseScroll", wheelListener);
|
||||||
OpenLayers.Event.observe(window, "mousewheel", wheelListener);
|
OpenLayers.Event.observe(window, "mousewheel", wheelListener);
|
||||||
OpenLayers.Event.observe(document, "mousewheel", wheelListener);
|
OpenLayers.Event.observe(document, "mousewheel", wheelListener);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
deactivate: function (evt) {
|
deactivate: function (evt) {
|
||||||
OpenLayers.Handler.prototype.deactivate.apply(this, arguments);
|
if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
|
||||||
// unregister mousewheel events specifically on the window and document
|
// unregister mousewheel events specifically on the window and document
|
||||||
var wheelListener = this.wheelListener;
|
var wheelListener = this.wheelListener;
|
||||||
OpenLayers.Event.stopObserving(window, "DOMMouseScroll", wheelListener);
|
OpenLayers.Event.stopObserving(window, "DOMMouseScroll", wheelListener);
|
||||||
OpenLayers.Event.stopObserving(window, "mousewheel", wheelListener);
|
OpenLayers.Event.stopObserving(window, "mousewheel", wheelListener);
|
||||||
OpenLayers.Event.stopObserving(document, "mousewheel", wheelListener);
|
OpenLayers.Event.stopObserving(document, "mousewheel", wheelListener);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
|
|||||||
Reference in New Issue
Block a user