OpenLayers OpenLayers

Changeset 577

Show
Ignore:
Timestamp:
06/12/06 12:09:02 (2 years ago)
Author:
euzuro
Message:

adding comment for dealing with popups and layers

Files:

Legend:

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

    r573 r577  
    145145    }, 
    146146 
    147     /** 
     147    /** Removes a layer from the map by removing its visual element (the  
     148     *   layer.div property), then removing it from the map's internal list  
     149     *   of layers, setting the layer's map property to null.  
     150     *  
     151     *   a "removelayer" event is triggered. 
     152     *  
     153     *   very worthy of mention is that simply removing a layer from a map 
     154     *   will not cause the removal of any popups which may have been created 
     155     *   by the layer. this is due to the fact that it was decided at some 
     156     *   point that popups would not belong to layers. thus there is no way  
     157     *   for us to know here to which layer the popup belongs. 
     158     *     
     159     *     A simple solution to this is simply to call destroy() on the layer. 
     160     *     the default OpenLayers.Layer class's destroy() function 
     161     *     automatically takes care to remove itself from whatever map it has 
     162     *     been attached to.  
     163     *  
     164     *     The correct solution is for the layer itself to register an  
     165     *     event-handler on "removelayer" and when it is called, if it  
     166     *     recognizes itself as the layer being removed, then it cycles through 
     167     *     its own personal list of popups, removing them from the map. 
     168     *  
    148169     * @param {OpenLayers.Layer} layer 
    149170     */