OpenLayers OpenLayers

Changeset 6557

Show
Ignore:
Timestamp:
03/19/08 17:09:53 (10 months ago)
Author:
pagameba
Message:

Closes #1451: change test to be (hopefully) map unit independent. r=crschmidt.

Files:

Legend:

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

    r6431 r6557  
    155155        } 
    156156 
     157        var curMapUnits = this.map.units; 
     158        var inches = OpenLayers.INCHES_PER_UNIT; 
     159 
    157160        // convert maxWidth to map units 
    158         var maxSizeData = this.maxWidth * res;   
     161        var maxSizeData = this.maxWidth * res * inches[curMapUnits];   
    159162 
    160163        // decide whether to use large or small scale units      
    161164        var topUnits; 
    162165        var bottomUnits; 
    163         if(maxSizeData > 0.1) { 
     166        if(maxSizeData > 100000) { 
    164167            topUnits = this.topOutUnits; 
    165168            bottomUnits = this.bottomOutUnits; 
     
    170173 
    171174        // and to map units units 
    172         var curMapUnits = this.map.units; 
    173         var inches = OpenLayers.INCHES_PER_UNIT; 
    174         var topMax = maxSizeData * inches[curMapUnits] / inches[topUnits]; 
    175         var bottomMax = maxSizeData * inches[curMapUnits] / inches[bottomUnits]; 
     175        var topMax = maxSizeData / inches[topUnits]; 
     176        var bottomMax = maxSizeData / inches[bottomUnits]; 
    176177 
    177178        // now trim this down to useful block length