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:
@@ -139,6 +139,15 @@ OpenLayers.Control = OpenLayers.Class({
|
||||
this.handler.destroy();
|
||||
this.handler = null;
|
||||
}
|
||||
if(this.handlers) {
|
||||
for(var key in this.handlers) {
|
||||
if(this.handlers.hasOwnProperty(key) &&
|
||||
typeof this.handlers[key].destroy == "function") {
|
||||
this.handlers[key].destroy();
|
||||
}
|
||||
}
|
||||
this.handlers = null;
|
||||
}
|
||||
if (this.map) {
|
||||
this.map.removeControl(this);
|
||||
this.map = null;
|
||||
|
||||
@@ -76,24 +76,12 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
feature: null,
|
||||
|
||||
/**
|
||||
* Property: dragHandler
|
||||
* {<OpenLayers.Handler.Drag>}
|
||||
*/
|
||||
dragHandler: null,
|
||||
|
||||
/**
|
||||
* Property: dragCallbacks
|
||||
* {Object} The functions that are sent to the drag handler for callback.
|
||||
*/
|
||||
dragCallbacks: {},
|
||||
|
||||
/**
|
||||
* Property: featureHandler
|
||||
* {<OpenLayers.Handler.Feature>}
|
||||
*/
|
||||
featureHandler: null,
|
||||
|
||||
/**
|
||||
* Property: featureCallbacks
|
||||
* {Object} The functions that are sent to the feature handler for callback.
|
||||
@@ -119,20 +107,24 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
initialize: function(layer, options) {
|
||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||
this.layer = layer;
|
||||
this.dragCallbacks = OpenLayers.Util.extend({down: this.downFeature,
|
||||
this.handlers = {
|
||||
drag: new OpenLayers.Handler.Drag(
|
||||
this, OpenLayers.Util.extend({
|
||||
down: this.downFeature,
|
||||
move: this.moveFeature,
|
||||
up: this.upFeature,
|
||||
out: this.cancel,
|
||||
done: this.doneDragging
|
||||
}, this.dragCallbacks);
|
||||
this.dragHandler = new OpenLayers.Handler.Drag(this, this.dragCallbacks);
|
||||
this.featureCallbacks = OpenLayers.Util.extend({over: this.overFeature,
|
||||
}, this.dragCallbacks)
|
||||
),
|
||||
feature: new OpenLayers.Handler.Feature(
|
||||
this, this.layer, OpenLayers.Util.extend({
|
||||
over: this.overFeature,
|
||||
out: this.outFeature
|
||||
}, this.featureCallbacks);
|
||||
var handlerOptions = {geometryTypes: this.geometryTypes};
|
||||
this.featureHandler = new OpenLayers.Handler.Feature(this, this.layer,
|
||||
this.featureCallbacks,
|
||||
handlerOptions);
|
||||
}, this.featureCallbacks),
|
||||
{geometryTypes: this.geometryTypes}
|
||||
)
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -141,8 +133,6 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
destroy: function() {
|
||||
this.layer = null;
|
||||
this.dragHandler.destroy();
|
||||
this.featureHandler.destroy();
|
||||
OpenLayers.Control.prototype.destroy.apply(this, []);
|
||||
},
|
||||
|
||||
@@ -154,7 +144,7 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* {Boolean} Successfully activated the control and feature handler.
|
||||
*/
|
||||
activate: function() {
|
||||
return (this.featureHandler.activate() &&
|
||||
return (this.handlers.feature.activate() &&
|
||||
OpenLayers.Control.prototype.activate.apply(this, arguments));
|
||||
},
|
||||
|
||||
@@ -167,8 +157,8 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
deactivate: function() {
|
||||
// the return from the handlers is unimportant in this case
|
||||
this.dragHandler.deactivate();
|
||||
this.featureHandler.deactivate();
|
||||
this.handlers.drag.deactivate();
|
||||
this.handlers.feature.deactivate();
|
||||
this.feature = null;
|
||||
this.dragging = false;
|
||||
this.lastPixel = null;
|
||||
@@ -184,9 +174,9 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* feature - {<OpenLayers.Feature.Vector>} The selected feature.
|
||||
*/
|
||||
overFeature: function(feature) {
|
||||
if(!this.dragHandler.dragging) {
|
||||
if(!this.handlers.drag.dragging) {
|
||||
this.feature = feature;
|
||||
this.dragHandler.activate();
|
||||
this.handlers.drag.activate();
|
||||
this.over = true;
|
||||
// TBD replace with CSS classes
|
||||
this.map.div.style.cursor = "move";
|
||||
@@ -238,7 +228,7 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
upFeature: function(pixel) {
|
||||
if(!this.over) {
|
||||
this.dragHandler.deactivate();
|
||||
this.handlers.drag.deactivate();
|
||||
this.feature = null;
|
||||
// TBD replace with CSS classes
|
||||
this.map.div.style.cursor = "default";
|
||||
@@ -265,9 +255,9 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* feature - {<OpenLayers.Feature.Vector>} The feature that the mouse left.
|
||||
*/
|
||||
outFeature: function(feature) {
|
||||
if(!this.dragHandler.dragging) {
|
||||
if(!this.handlers.drag.dragging) {
|
||||
this.over = false;
|
||||
this.dragHandler.deactivate();
|
||||
this.handlers.drag.deactivate();
|
||||
// TBD replace with CSS classes
|
||||
this.map.div.style.cursor = "default";
|
||||
this.feature = null;
|
||||
@@ -283,7 +273,7 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* Called when the drag handler detects a mouse-out (from the map viewport).
|
||||
*/
|
||||
cancel: function() {
|
||||
this.dragHandler.deactivate();
|
||||
this.handlers.drag.deactivate();
|
||||
this.over = false;
|
||||
},
|
||||
|
||||
@@ -295,8 +285,8 @@ OpenLayers.Control.DragFeature = OpenLayers.Class(OpenLayers.Control, {
|
||||
* map - {<OpenLayers.Map>} The control's map.
|
||||
*/
|
||||
setMap: function(map) {
|
||||
this.dragHandler.setMap(map);
|
||||
this.featureHandler.setMap(map);
|
||||
this.handlers.drag.setMap(map);
|
||||
this.handlers.feature.setMap(map);
|
||||
OpenLayers.Control.prototype.setMap.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -98,10 +98,10 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||
mapOptions: null,
|
||||
|
||||
/**
|
||||
* Property: dragHandler
|
||||
* {<OpenLayers.Handler.Drag>} A handler for dragging the extent rectangle.
|
||||
* Property: handlers
|
||||
* {Object}
|
||||
*/
|
||||
dragHandler: null,
|
||||
handlers: null,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Control.OverviewMap
|
||||
@@ -114,6 +114,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||
*/
|
||||
initialize: function(options) {
|
||||
this.layers = [];
|
||||
this.handlers = {};
|
||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||
},
|
||||
|
||||
@@ -125,8 +126,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||
if (!this.mapDiv) { // we've already been destroyed
|
||||
return;
|
||||
}
|
||||
this.dragHandler.destroy();
|
||||
this.clickHandler.destroy();
|
||||
this.handlers.click.destroy();
|
||||
|
||||
this.mapDiv.removeChild(this.extentRectangle);
|
||||
this.extentRectangle = null;
|
||||
@@ -280,8 +280,8 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||
* px - {<OpenLayers.Pixel>} The pixel location of the drag.
|
||||
*/
|
||||
rectDrag: function(px) {
|
||||
var deltaX = this.dragHandler.last.x - px.x;
|
||||
var deltaY = this.dragHandler.last.y - px.y;
|
||||
var deltaX = this.handlers.drag.last.x - px.x;
|
||||
var deltaY = this.handlers.drag.last.y - px.y;
|
||||
if(deltaX != 0 || deltaY != 0) {
|
||||
var rectTop = this.rectPxBounds.top;
|
||||
var rectLeft = this.rectPxBounds.left;
|
||||
@@ -456,11 +456,11 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||
'border-bottom-width'));
|
||||
this.hComp = (this.hComp) ? this.hComp : 2;
|
||||
|
||||
this.dragHandler = new OpenLayers.Handler.Drag(
|
||||
this.handlers.drag = new OpenLayers.Handler.Drag(
|
||||
this, {move: this.rectDrag, done: this.updateMapToRect},
|
||||
{map: this.ovmap}
|
||||
);
|
||||
this.clickHandler = new OpenLayers.Handler.Click(
|
||||
this.handlers.click = new OpenLayers.Handler.Click(
|
||||
this, {
|
||||
"click": this.mapDivClick
|
||||
},{
|
||||
@@ -470,18 +470,18 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
||||
map: this.ovmap
|
||||
}
|
||||
);
|
||||
this.clickHandler.activate();
|
||||
this.handlers.click.activate();
|
||||
|
||||
this.rectEvents = new OpenLayers.Events(this, this.extentRectangle,
|
||||
null, true);
|
||||
this.rectEvents.register("mouseover", this, function(e) {
|
||||
if(!this.dragHandler.active && !this.map.dragging) {
|
||||
this.dragHandler.activate();
|
||||
if(!this.handlers.drag.active && !this.map.dragging) {
|
||||
this.handlers.drag.activate();
|
||||
}
|
||||
});
|
||||
this.rectEvents.register("mouseout", this, function(e) {
|
||||
if(!this.dragHandler.dragging) {
|
||||
this.dragHandler.deactivate();
|
||||
if(!this.handlers.drag.dragging) {
|
||||
this.handlers.drag.deactivate();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"new OpenLayers.Control.DragFeature returns an instance");
|
||||
t.eq(control.layer, "bar",
|
||||
"constructor sets layer correctly");
|
||||
t.eq(control.featureHandler.geometryTypes, "foo",
|
||||
t.eq(control.handlers.feature.geometryTypes, "foo",
|
||||
"constructor sets options correctly on feature handler");
|
||||
}
|
||||
|
||||
@@ -24,14 +24,15 @@
|
||||
var layer = new OpenLayers.Layer.Vector();
|
||||
map.addLayer(layer);
|
||||
var control = new OpenLayers.Control.DragFeature(layer);
|
||||
control.dragHandler.destroy = function() {
|
||||
control.handlers.drag.destroy = function() {
|
||||
t.ok(true,
|
||||
"control.destroy calls destroy on drag handler");
|
||||
}
|
||||
control.featureHandler.destroy = function() {
|
||||
control.handlers.feature.destroy = function() {
|
||||
t.ok(true,
|
||||
"control.destroy calls destroy on feature handler");
|
||||
}
|
||||
|
||||
control.destroy();
|
||||
|
||||
}
|
||||
@@ -43,10 +44,10 @@
|
||||
map.addLayer(layer);
|
||||
var control = new OpenLayers.Control.DragFeature(layer);
|
||||
map.addControl(control);
|
||||
t.ok(!control.featureHandler.active,
|
||||
t.ok(!control.handlers.feature.active,
|
||||
"feature handler is not active prior to activating control");
|
||||
control.activate();
|
||||
t.ok(control.featureHandler.active,
|
||||
t.ok(control.handlers.feature.active,
|
||||
"feature handler is active after activating control");
|
||||
}
|
||||
|
||||
@@ -58,11 +59,11 @@
|
||||
var control = new OpenLayers.Control.DragFeature(layer);
|
||||
map.addControl(control);
|
||||
|
||||
control.dragHandler.deactivate = function() {
|
||||
control.handlers.drag.deactivate = function() {
|
||||
t.ok(true,
|
||||
"control.deactivate calls deactivate on drag handler");
|
||||
}
|
||||
control.featureHandler.deactivate = function() {
|
||||
control.handlers.feature.deactivate = function() {
|
||||
t.ok(true,
|
||||
"control.deactivate calls deactivate on feature handler");
|
||||
}
|
||||
@@ -78,7 +79,7 @@
|
||||
map.addControl(control);
|
||||
|
||||
control.activate();
|
||||
t.ok(!control.dragHandler.active,
|
||||
t.ok(!control.handlers.drag.active,
|
||||
"drag handler is not active before over a feature");
|
||||
|
||||
// simulate a mouseover on a feature
|
||||
@@ -89,7 +90,7 @@
|
||||
|
||||
t.eq(control.feature, "foo",
|
||||
"control gets the proper feature from the feature handler");
|
||||
t.ok(control.dragHandler.active,
|
||||
t.ok(control.handlers.drag.active,
|
||||
"drag handler activated when over a feature");
|
||||
}
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@
|
||||
control.handleKeypress(dKey);
|
||||
|
||||
// now make sure nothing happens if the vertex is mid-drag
|
||||
control.dragControl.dragHandler.dragging = true;
|
||||
control.dragControl.handlers.drag.dragging = true;
|
||||
control.handleKeypress(delKey);
|
||||
|
||||
// reset modified methods
|
||||
@@ -305,11 +305,11 @@
|
||||
control.dragControl.map.div = {};
|
||||
control.dragControl.map.div.style = {};
|
||||
control.dragControl.map.div.cursor = "foo";
|
||||
control.dragControl.dragHandler.deactivate = function() {
|
||||
control.dragControl.handlers.drag.deactivate = function() {
|
||||
this.active = false;
|
||||
}
|
||||
control.resetVertices();
|
||||
t.ok(!control.dragControl.dragHandler.active, "resetVertices deactivates drag handler");
|
||||
t.ok(!control.dragControl.handlers.drag.active, "resetVertices deactivates drag handler");
|
||||
control.dragControl.map = null;
|
||||
|
||||
control.destroy();
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
}
|
||||
|
||||
function test_Control_Navigation_destroy (t) {
|
||||
t.plan(10);
|
||||
t.plan(9);
|
||||
|
||||
var temp = OpenLayers.Control.prototype.destroy;
|
||||
OpenLayers.Control.prototype.destroy = function() {
|
||||
t.ok(true, "OpenLayers.Control's destroy called");
|
||||
temp.call(this);
|
||||
};
|
||||
|
||||
var control = {
|
||||
@@ -38,16 +39,18 @@
|
||||
t.ok(true, "zoomBox destroyed");
|
||||
}
|
||||
},
|
||||
'wheelHandler': {
|
||||
handlers: {
|
||||
'wheel': {
|
||||
'destroy': function() {
|
||||
t.ok(true, "wheelHandler destroyed");
|
||||
}
|
||||
},
|
||||
'clickHandler': {
|
||||
'click': {
|
||||
'destroy': function() {
|
||||
t.ok(true, "clickHandler destroyed");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//this will also trigger one test by calling OpenLayers.Control's destroy
|
||||
@@ -56,8 +59,7 @@
|
||||
|
||||
t.eq(control.dragPan, null, "'dragPan' set to null");
|
||||
t.eq(control.zoomBox, null, "'zoomBox' set to null");
|
||||
t.eq(control.wheelHandler, null, "'wheelHandler' set to null");
|
||||
t.eq(control.clickHandler, null, "'clickHandler' set to null");
|
||||
t.eq(control.handlers, null, "handlers set to null");
|
||||
|
||||
OpenLayers.Control.prototype.destroy = temp;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
t.eq(cent.lon, -71.3515625, "Clicking on the Overview Map has the correct effect on map lon");
|
||||
t.eq(cent.lat, 42.17578125, "Clicking on the Overview Map has the correct effect on map lat");
|
||||
|
||||
control.dragHandler = {
|
||||
control.handlers.drag = {
|
||||
last: new OpenLayers.Pixel(5,5),
|
||||
destroy: function() {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user