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

git-svn-id: http://svn.openlayers.org/trunk/openlayers@6557 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Paul Spencer
2008-03-19 21:09:53 +00:00
parent 2694905155
commit 8b759ab1d6

View File

@@ -154,13 +154,16 @@ OpenLayers.Control.ScaleLine = OpenLayers.Class(OpenLayers.Control, {
return;
}
var curMapUnits = this.map.units;
var inches = OpenLayers.INCHES_PER_UNIT;
// convert maxWidth to map units
var maxSizeData = this.maxWidth * res;
var maxSizeData = this.maxWidth * res * inches[curMapUnits];
// decide whether to use large or small scale units
var topUnits;
var bottomUnits;
if(maxSizeData > 0.1) {
if(maxSizeData > 100000) {
topUnits = this.topOutUnits;
bottomUnits = this.bottomOutUnits;
} else {
@@ -169,10 +172,8 @@ OpenLayers.Control.ScaleLine = OpenLayers.Class(OpenLayers.Control, {
}
// and to map units units
var curMapUnits = this.map.units;
var inches = OpenLayers.INCHES_PER_UNIT;
var topMax = maxSizeData * inches[curMapUnits] / inches[topUnits];
var bottomMax = maxSizeData * inches[curMapUnits] / inches[bottomUnits];
var topMax = maxSizeData / inches[topUnits];
var bottomMax = maxSizeData / inches[bottomUnits];
// now trim this down to useful block length
var topRounded = this.getBarLen(topMax);