For controls with multiple handlers, we now tack them on to a handlers object. The base destroy takes care of the handlers. r=crschmidt,uz/2 (closes #1338)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@6106 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -36,12 +36,6 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
zoomBox: null,
|
||||
|
||||
/**
|
||||
* Property: wheelHandler
|
||||
* {<OpenLayers.Handler.MouseWheel>}
|
||||
*/
|
||||
wheelHandler: null,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.Navigation
|
||||
* Create a new navigation control
|
||||
@@ -51,6 +45,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
* the control
|
||||
*/
|
||||
initialize: function(options) {
|
||||
this.handlers = {};
|
||||
OpenLayers.Control.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
@@ -61,8 +56,6 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
* to prevent memory leaks.
|
||||
*/
|
||||
destroy: function() {
|
||||
OpenLayers.Control.prototype.destroy.apply(this,arguments);
|
||||
|
||||
this.deactivate();
|
||||
|
||||
if (this.dragPan) {
|
||||
@@ -70,20 +63,11 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
}
|
||||
this.dragPan = null;
|
||||
|
||||
if (this.wheelHandler) {
|
||||
this.wheelHandler.destroy();
|
||||
}
|
||||
this.wheelHandler = null;
|
||||
|
||||
if (this.clickHandler) {
|
||||
this.clickHandler.destroy();
|
||||
}
|
||||
this.clickHandler = null;
|
||||
|
||||
if (this.zoomBox) {
|
||||
this.zoomBox.destroy();
|
||||
}
|
||||
this.zoomBox = null;
|
||||
OpenLayers.Control.prototype.destroy.apply(this,arguments);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -91,8 +75,8 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
activate: function() {
|
||||
this.dragPan.activate();
|
||||
this.wheelHandler.activate();
|
||||
this.clickHandler.activate();
|
||||
this.handlers.wheel.activate();
|
||||
this.handlers.click.activate();
|
||||
this.zoomBox.activate();
|
||||
return OpenLayers.Control.prototype.activate.apply(this,arguments);
|
||||
},
|
||||
@@ -103,8 +87,8 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
deactivate: function() {
|
||||
this.zoomBox.deactivate();
|
||||
this.dragPan.deactivate();
|
||||
this.clickHandler.deactivate();
|
||||
this.wheelHandler.deactivate();
|
||||
this.handlers.click.deactivate();
|
||||
this.handlers.wheel.deactivate();
|
||||
return OpenLayers.Control.prototype.deactivate.apply(this,arguments);
|
||||
},
|
||||
|
||||
@@ -112,7 +96,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
* Method: draw
|
||||
*/
|
||||
draw: function() {
|
||||
this.clickHandler = new OpenLayers.Handler.Click(this,
|
||||
this.handlers.click = new OpenLayers.Handler.Click(this,
|
||||
{ 'dblclick': this.defaultDblClick },
|
||||
{
|
||||
'double': true,
|
||||
@@ -123,7 +107,7 @@ OpenLayers.Control.Navigation = OpenLayers.Class(OpenLayers.Control, {
|
||||
{map: this.map, keyMask: OpenLayers.Handler.MOD_SHIFT});
|
||||
this.dragPan.draw();
|
||||
this.zoomBox.draw();
|
||||
this.wheelHandler = new OpenLayers.Handler.MouseWheel(
|
||||
this.handlers.wheel = new OpenLayers.Handler.MouseWheel(
|
||||
this, {"up" : this.wheelUp,
|
||||
"down": this.wheelDown} );
|
||||
this.activate();
|
||||
|
||||
Reference in New Issue
Block a user