OpenLayers OpenLayers

Changeset 2205

Show
Ignore:
Timestamp:
02/05/07 11:28:33 (2 years ago)
Author:
emanuel
Message:

1.1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/emanuel/animatedZooming/lib/OpenLayers/Control/OverviewMap.js

    r2190 r2205  
    384384                (this.ovmap.getExtent().containsBounds(testExtent))); 
    385385    }, 
    386      
    387     updateOverview: function() { 
    388         var mapRes = this.map.getResolution(); 
     386 
     387    /*  
     388     * Updates the overview map. If the map is scaling (by zooming) the parameters 
     389     * define the values of the new resolution and bounds. 
     390     * 
     391     * @param {float} newResolution 
     392     * @param {OpenLayers.Bounds} bounds 
     393     */     
     394    updateOverview: function(newResolution, bounds) { 
     395        //set new map resolution only by scaling 
     396        if (newResolution) 
     397            var mapRes = newResolution; 
     398        else 
     399            var mapRes = this.map.getResolution(); 
    389400        var targetRes = this.ovmap.getResolution(); 
    390401        var resRatio = targetRes / mapRes; 
     
    398409        this.ovmap.setCenter(this.map.center, 
    399410                            this.ovmap.getZoomForResolution(targetRes)); 
    400         this.updateRectToMap(); 
     411        this.updateRectToMap(bounds); 
    401412    }, 
    402413     
     
    422433         
    423434    /** 
    424      * Updates the extent rectangle position and size to match the map extent 
    425      */ 
    426     updateRectToMap: function() { 
     435     * Updates the extent rectangle position and size to match the map extent   
     436     * If the map is scaling (by zooming) the parameter defines the 
     437     * new bounds of the current map 
     438     * 
     439     * @param {OpenLayers.Bounds} bounds 
     440     */ 
     441    updateRectToMap: function(bounds) { 
    427442        // The base layer for overview map needs to be in the same projection 
    428443        // as the base layer for the main map.  This should be made more robust. 
     
    432447            } 
    433448        } 
    434         var pxBounds = this.getRectBoundsFromMapBounds(this.map.getExtent()); 
     449 
     450        if (!bounds) 
     451            bounds=this.map.getExtent(); 
     452        var pxBounds = this.getRectBoundsFromMapBounds(bounds); 
    435453        this.setRectPxBounds(pxBounds); 
    436454    },