OpenLayers OpenLayers

Changeset 3329

Show
Ignore:
Timestamp:
06/14/07 15:18:57 (1 year ago)
Author:
euzuro
Message:

additional patch for #742 - removeControl() now takes the control as argument, not the id

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Map.js

    r3323 r3329  
    622622     *   viewPort (assuming the control was not added outsideViewport) 
    623623     *  
    624      * @param {String} id ID of the control to remove 
     624     * @param {OpenLayers.Control} control control to remove 
    625625     */     
    626     removeControl: function (id) { 
    627         var control = this.getControl(id); 
    628         if (control) { 
     626    removeControl: function (control) { 
     627        //make sure control is non-null and actually part of our map 
     628        if ( (control) && (control == this.getControl(control.id)) ) { 
    629629            if (!control.outsideViewport) { 
    630630                this.viewPortDiv.removeChild(control.div) 
  • trunk/openlayers/tests/test_Map.html

    r3282 r3329  
    432432 
    433433    //remove control         
    434         map1.removeControl(control.id
     434        map1.removeControl(control
    435435        newNumControls = map1.controls.length; 
    436436        t.ok( newNumControls == oldNumControls, "removing the control decreases control count") 
     
    449449 
    450450    //remove bogus 
    451         map1.removeControl("bogus id"); 
     451        control = { id: "bogus id" }; 
     452        map1.removeControl(control); 
    452453        newNumControls = map1.controls.length; 
    453454        t.ok( newNumControls == oldNumControls, "removing bad controlid doesnt crash or decrease control count")