[OpenLayers-Commits] r11459 - in trunk/openlayers:
lib/OpenLayers/Control tests/Control
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Fri Feb 25 03:52:29 EST 2011
Author: fredj
Date: 2011-02-25 00:52:28 -0800 (Fri, 25 Feb 2011)
New Revision: 11459
Modified:
trunk/openlayers/lib/OpenLayers/Control/Geolocate.js
trunk/openlayers/tests/Control/Geolocate.html
Log:
deactivate the Geolocate control on destroy. r=bartvde,elemoine (closes #1185)
Modified: trunk/openlayers/lib/OpenLayers/Control/Geolocate.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Control/Geolocate.js 2011-02-25 08:48:33 UTC (rev 11458)
+++ trunk/openlayers/lib/OpenLayers/Control/Geolocate.js 2011-02-25 08:52:28 UTC (rev 11459)
@@ -74,6 +74,14 @@
},
/**
+ * Method: destroy
+ */
+ destroy: function() {
+ this.deactivate();
+ OpenLayers.Control.prototype.destroy.apply(this, arguments);
+ },
+
+ /**
* Method: activate
* Activates the control.
*
Modified: trunk/openlayers/tests/Control/Geolocate.html
===================================================================
--- trunk/openlayers/tests/Control/Geolocate.html 2011-02-25 08:48:33 UTC (rev 11458)
+++ trunk/openlayers/tests/Control/Geolocate.html 2011-02-25 08:52:28 UTC (rev 11459)
@@ -113,6 +113,17 @@
map.addControl(control);
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() {
map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.WMS("Test Layer",
More information about the Commits
mailing list