Map should deactivate removed controls, removal of pythonic lack of ';' caught
by elemoine in his review. (Closes #1880) git-svn-id: http://svn.openlayers.org/trunk/openlayers@8530 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -1130,6 +1130,7 @@ OpenLayers.Map = OpenLayers.Class({
|
|||||||
removeControl: function (control) {
|
removeControl: function (control) {
|
||||||
//make sure control is non-null and actually part of our map
|
//make sure control is non-null and actually part of our map
|
||||||
if ( (control) && (control == this.getControl(control.id)) ) {
|
if ( (control) && (control == this.getControl(control.id)) ) {
|
||||||
|
control.deactivate();
|
||||||
if (control.div && (control.div.parentNode == this.viewPortDiv)) {
|
if (control.div && (control.div.parentNode == this.viewPortDiv)) {
|
||||||
this.viewPortDiv.removeChild(control.div);
|
this.viewPortDiv.removeChild(control.div);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,16 @@
|
|||||||
control2.destroy();
|
control2.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_Control_removeControl(t) {
|
||||||
|
t.plan(1);
|
||||||
|
var map = new OpenLayers.Map('map');
|
||||||
|
var control = new OpenLayers.Control();
|
||||||
|
map.addControl(control);
|
||||||
|
control.deactivate = function() {
|
||||||
|
t.ok(true, "Deactivate is called.");
|
||||||
|
};
|
||||||
|
map.removeControl(control);
|
||||||
|
}
|
||||||
function test_Control_destroy(t) {
|
function test_Control_destroy(t) {
|
||||||
t.plan(3);
|
t.plan(3);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user