deactivate the Geolocate control on destroy. r=bartvde,elemoine (closes #1185)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11459 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -73,6 +73,14 @@ OpenLayers.Control.Geolocate = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
OpenLayers.Control.prototype.initialize.apply(this, [options]);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method: destroy
|
||||||
|
*/
|
||||||
|
destroy: function() {
|
||||||
|
this.deactivate();
|
||||||
|
OpenLayers.Control.prototype.destroy.apply(this, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method: activate
|
* Method: activate
|
||||||
* Activates the control.
|
* Activates the control.
|
||||||
|
|||||||
@@ -113,6 +113,17 @@
|
|||||||
map.addControl(control);
|
map.addControl(control);
|
||||||
control.activate();
|
control.activate();
|
||||||
}
|
}
|
||||||
|
function test_destroy(t) {
|
||||||
|
t.plan(1);
|
||||||
|
var control = new OpenLayers.Control.Geolocate({
|
||||||
|
geolocation: geolocation,
|
||||||
|
watch: true
|
||||||
|
});
|
||||||
|
control.activate();
|
||||||
|
control.destroy();
|
||||||
|
t.ok(control.active === false, "control deactivated before being destroyed");
|
||||||
|
}
|
||||||
|
|
||||||
function loader() {
|
function loader() {
|
||||||
map = new OpenLayers.Map('map');
|
map = new OpenLayers.Map('map');
|
||||||
var layer = new OpenLayers.Layer.WMS("Test Layer",
|
var layer = new OpenLayers.Layer.WMS("Test Layer",
|
||||||
|
|||||||
Reference in New Issue
Block a user