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