OpenLayers OpenLayers

Changeset 1275

Show
Ignore:
Timestamp:
08/17/06 01:52:07 (2 years ago)
Author:
euzuro
Message:

update map resize functionality to deal with google layer. if ve had a similar checkResize() function, then we would be able to safely resize an OL map with a ve layer in it as well. unfortunately, this is not the case. a bug report i am gonna file

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/openlayers/2.0/lib/OpenLayers/Layer.js

    r1259 r1275  
    149149    }, 
    150150     
     151    /** 
     152     *  
     153     */ 
     154    onMapResize: function() { 
     155        //this function can be implemented by subclasses   
     156    }, 
    151157 
    152158    /** 
  • branches/openlayers/2.0/lib/OpenLayers/Layer/Google.js

    r1262 r1275  
    146146            this.loadWarningMessage(); 
    147147        } 
     148    }, 
     149 
     150    /** 
     151     * @param {Event} evt 
     152     */ 
     153    onMapResize: function() { 
     154        this.gmap.checkResize();   
    148155    }, 
    149156 
  • branches/openlayers/2.0/lib/OpenLayers/Map.js

    r1259 r1275  
    149149                          this.updateSize.bindAsEventListener(this)); 
    150150        } 
    151  
     151         
    152152        //set the default options 
    153153        this.setOptions(options); 
     
    471471            this.size = oldSize = newSize; 
    472472        if (!newSize.equals(oldSize)) { 
    473             // move the layer container so that the map is still centered 
    474             var dx = (newSize.w - oldSize.w) / 2, 
    475                 dy = (newSize.h - oldSize.h) / 2; 
    476             var lcStyle = this.layerContainerDiv.style; 
    477             lcStyle.left = (parseInt(lcStyle.left) + dx) + "px"; 
    478             lcStyle.top  = (parseInt(lcStyle.top ) + dy) + "px"; 
    479             // reset the map center 
    480             this.layerContainerOrigin = this.center.clone(); 
     473             
     474            //notify layers of mapresize 
     475            for(var i=0; i < this.layers.length; i++) { 
     476                this.layers[i].onMapResize();                 
     477            } 
     478 
     479            var center = new OpenLayers.Pixel(newSize.w /2, newSize.h / 2); 
     480             
     481            var zoom = this.getZoom(); 
     482            this.zoom = null; 
     483            this.setCenter(center, zoom); 
     484             
    481485            // store the new size 
    482486            this.size = newSize;