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:
@@ -83,10 +83,10 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
dragControl: null,
|
||||
|
||||
/**
|
||||
* Property: keyboardHandler
|
||||
* {<OpenLayers.Handler.Keyboard>}
|
||||
* Property: handlers
|
||||
* {Object}
|
||||
*/
|
||||
keyboardHandler: null,
|
||||
handlers: null,
|
||||
|
||||
/**
|
||||
* APIProperty: deleteCodes
|
||||
@@ -216,9 +216,9 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
var keyboardOptions = {
|
||||
keypress: this.handleKeypress
|
||||
};
|
||||
this.keyboardHandler = new OpenLayers.Handler.Keyboard(
|
||||
this, keyboardOptions
|
||||
);
|
||||
this.handlers = {
|
||||
keyboard: new OpenLayers.Handler.Keyboard(this, keyboardOptions)
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -229,7 +229,6 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.layer = null;
|
||||
this.selectControl.destroy();
|
||||
this.dragControl.destroy();
|
||||
this.keyboardHandler.destroy();
|
||||
OpenLayers.Control.prototype.destroy.apply(this, []);
|
||||
},
|
||||
|
||||
@@ -242,7 +241,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
activate: function() {
|
||||
return (this.selectControl.activate() &&
|
||||
this.keyboardHandler.activate() &&
|
||||
this.handlers.keyboard.activate() &&
|
||||
OpenLayers.Control.prototype.activate.apply(this, arguments));
|
||||
},
|
||||
|
||||
@@ -266,7 +265,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
[this.feature]);
|
||||
}
|
||||
this.selectControl.deactivate();
|
||||
this.keyboardHandler.deactivate();
|
||||
this.handlers.keyboard.deactivate();
|
||||
deactivated = true;
|
||||
}
|
||||
return deactivated;
|
||||
@@ -352,9 +351,9 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
this.dragControl.overFeature.apply(this.dragControl,
|
||||
[feature]);
|
||||
this.dragControl.lastPixel = pixel;
|
||||
this.dragControl.dragHandler.started = true;
|
||||
this.dragControl.dragHandler.start = pixel;
|
||||
this.dragControl.dragHandler.last = pixel;
|
||||
this.dragControl.handlers.drag.started = true;
|
||||
this.dragControl.handlers.drag.start = pixel;
|
||||
this.dragControl.handlers.drag.last = pixel;
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -486,7 +485,7 @@ OpenLayers.Control.ModifyFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
var vertex = this.dragControl.feature;
|
||||
if(vertex &&
|
||||
OpenLayers.Util.indexOf(this.vertices, vertex) != -1 &&
|
||||
!this.dragControl.dragHandler.dragging &&
|
||||
!this.dragControl.handlers.drag.dragging &&
|
||||
vertex.geometry.parent) {
|
||||
// remove the vertex
|
||||
vertex.geometry.parent.removeComponent(vertex.geometry);
|
||||
|
||||
Reference in New Issue
Block a user