OpenLayers OpenLayers

Changeset 7571

Show
Ignore:
Timestamp:
07/28/08 10:27:52 (4 months ago)
Author:
tschaub
Message:

Only trigger refresh if in range and visible. Trigger featuresremoved instead of featuresdestroyed (which is not listed in layer events).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/vector-behavior/lib/OpenLayers/Layer/Vector.js

    r7485 r7571  
    265265    /** 
    266266     * Method: refresh 
    267      * Ask the layer to request features again and redraw them. 
     267     * Ask the layer to request features again and redraw them.  Triggers 
     268     *     the refresh event if the layer is in range and visible. 
    268269     * 
    269270     * Parameters: 
     
    272273     */ 
    273274    refresh: function(event) { 
    274         this.events.triggerEvent("refresh", event); 
     275        if(this.inRange && this.visible) { 
     276            this.events.triggerEvent("refresh", event); 
     277        } 
    275278    }, 
    276279 
     
    509512    /** 
    510513     * APIMethod: destroyFeatures 
    511      * Erase and destroy features on the layer. 
     514     * Erase and destroy features on the layer.  The featuresremoved event 
     515     *     will be triggered unless the silent option is true. 
    512516     * 
    513517     * Parameters: 
     
    515519     *     features to destroy.  If not supplied, all features on the layer 
    516520     *     will be destroyed. 
    517      */ 
    518     destroyFeatures: function(features) { 
     521     * options - {Object} Options to control behavior while destroying features. 
     522     * 
     523     * Valid options: 
     524     * silent - {Boolean} Do not trigger any events while destroying.  Default 
     525     *     is false. 
     526     */ 
     527    destroyFeatures: function(features, options) { 
    519528        var all = (features == undefined); 
    520529        if(all) { 
     
    523532        } 
    524533        this.eraseFeatures(features); 
     534        if(!options || !options.silent) { 
     535            this.events.triggerEvent("featuresremoved", {features: features}); 
     536        } 
    525537        var feature; 
    526538        for(var i=features.length-1; i>=0; i--) { 
     
    531543            feature.destroy(); 
    532544        } 
    533         this.events.triggerEvent("featuresdestroyed", {features: this.features}); 
    534545    }, 
    535546