Ticket #1451: ScaleLine.patch
| File ScaleLine.patch, 1.3 kB (added by pspencer, 8 months ago) |
|---|
-
lib/OpenLayers/Control/ScaleLine.js
old new 154 154 return; 155 155 } 156 156 157 var curMapUnits = this.map.units; 158 var inches = OpenLayers.INCHES_PER_UNIT; 159 157 160 // convert maxWidth to map units 158 var maxSizeData = this.maxWidth * res ;161 var maxSizeData = this.maxWidth * res * inches[curMapUnits]; 159 162 160 163 // decide whether to use large or small scale units 161 164 var topUnits; 162 165 var bottomUnits; 163 if(maxSizeData > 0.1) {166 if(maxSizeData > 100000) { 164 167 topUnits = this.topOutUnits; 165 168 bottomUnits = this.bottomOutUnits; 166 169 } else { … … 169 172 } 170 173 171 174 // 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]; 176 177 177 178 // now trim this down to useful block length 178 179 var topRounded = this.getBarLen(topMax);
