OpenLayers OpenLayers

Ticket #795: redraw.patch

File redraw.patch, 1.7 kB (added by euzuro, 1 year ago)

create redraw function, apply it in the couple of relevant places

  • lib/OpenLayers/Layer.js

    old new  
    335335    }, 
    336336 
    337337    /** 
     338     * APIMethod: redraw 
     339     * Redraws the layer  
     340     */ 
     341    redraw: function() { 
     342         
     343        // min/max Range may have changed 
     344        this.inRange = this.calculateInRange(); 
     345         
     346        var bounds = this.getExtent(); 
     347        this.moveTo(bounds, true, false); 
     348    }, 
     349 
     350    /** 
    338351     * Method: moveTo 
    339352     *  
    340353     * Parameters: 
     
    450463    setVisibility: function(visibility, noEvent) { 
    451464        if (visibility != this.visibility) { 
    452465            this.visibility = visibility; 
    453             this.display(visibility); 
    454             if (visibility && this.map != null) { 
    455                 var extent = this.map.getExtent(); 
    456                 if (extent != null) { 
    457                     this.moveTo(extent, true); 
    458                 } 
    459             } 
     466            this.redraw(); 
    460467            if ((this.map != null) &&  
    461468                ((noEvent == null) || (noEvent == false))) { 
    462469                this.map.events.triggerEvent("changelayer"); 
  • lib/OpenLayers/Map.js

    old new  
    515515                layer.setVisibility(false); 
    516516            } 
    517517        } else { 
    518             if (this.getCenter() != null) { 
    519                 layer.moveTo(this.getExtent(), true);    
    520             } 
     518            layer.redraw(); 
    521519        } 
    522520 
    523521        this.events.triggerEvent("addlayer");