OpenLayers OpenLayers

Changeset 7423

Show
Ignore:
Timestamp:
06/23/08 12:12:53 (5 months ago)
Author:
tschaub
Message:

Caching center on bounds.

Files:

Legend:

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

    r7028 r7423  
    3939     * {Number} Maximum vertical coordinate. 
    4040     */ 
    41     top: null,     
     41    top: null, 
     42     
     43    /** 
     44     * Property: center 
     45     * {<OpenLayers.LonLat>} Use <getCenterLonLat>. 
     46     */ 
     47    center: null, 
    4248 
    4349    /** 
     
    216222     */ 
    217223    getCenterLonLat:function() { 
    218         return new OpenLayers.LonLat( (this.left + this.right) / 2, 
    219                                       (this.bottom + this.top) / 2); 
     224        if(!this.center) { 
     225            this.center = new OpenLayers.LonLat( 
     226                (this.left + this.right) / 2, (this.bottom + this.top) / 2 
     227            ); 
     228        } 
     229        return this.center; 
    220230    }, 
    221231 
     
    282292            } 
    283293        } 
     294        this.center = null; 
    284295    }, 
    285296