OpenLayers OpenLayers

Changeset 4800

Show
Ignore:
Timestamp:
10/03/07 18:32:01 (1 year ago)
Author:
euzuro
Message:

rearranging the style here for setBaseLayer() so that it's more readable, less duplication of code. No functional change, all tests pass

Files:

Legend:

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

    r4792 r4800  
    708708                var center = this.getCenter(); 
    709709                if (center != null) { 
    710                     if (oldExtent == null) { 
    711                         // simply set center but force zoom change 
    712                         this.setCenter( 
    713                             center, 
    714                             this.getZoomForResolution(this.resolution, true), 
    715                             false, true 
    716                         ); 
    717                     } else { 
    718                         // zoom to oldExtent *and* force zoom change 
    719                         this.setCenter(oldExtent.getCenterLonLat(),  
    720                                        this.getZoomForExtent(oldExtent, true), 
    721                                        false, true); 
    722                     } 
     710 
     711                    //either get the center from the old Extent or just from 
     712                    // the current center of the map.  
     713                    var newCenter = (oldExtent)  
     714                        ? oldExtent.getCenterLonLat() 
     715                        : center; 
     716 
     717                    //the new zoom will either come from the old Extent or  
     718                    // from the current resolution of the map                                                 
     719                    var newZoom = (oldExtent)  
     720                        ? this.getZoomForExtent(oldExtent, true) 
     721                        : this.getZoomForResolution(this.resolution, true); 
     722 
     723                    // zoom and force zoom change 
     724                    this.setCenter(newCenter, newZoom, false, true); 
    723725                } 
    724726