fixing more tabs. all tests pass

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1011 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-07-26 14:44:44 +00:00
parent 3962b0a814
commit a171ae13b6
3 changed files with 25 additions and 25 deletions

View File

@@ -11,12 +11,12 @@ OpenLayers.Control.Scale = Class.create();
OpenLayers.Control.Scale.prototype =
Object.extend( new OpenLayers.Control(), {
INCHES_PER_UNIT: { // borrowed from MapServer mapscale.c
inches: 1.0,
ft: 12.0,
mi: 63360.0,
m: 39.3701,
km: 39370.1,
dd: 4374754
inches: 1.0,
ft: 12.0,
mi: 63360.0,
m: 39.3701,
km: 39370.1,
dd: 4374754
},
/** @type DOMElement */
@@ -57,7 +57,7 @@ OpenLayers.Control.Scale.prototype =
this.div.appendChild(this.element);
}
this.map.events.register( 'moveend', this, this.updateScale);
this.updateScale();
this.updateScale();
return this.div;
},
@@ -66,16 +66,16 @@ OpenLayers.Control.Scale.prototype =
*/
updateScale: function() {
var res = this.map.getResolution();
if (!res) return;
if (!res) return;
var scale = res * this.INCHES_PER_UNIT[this.units] * this.dpi;
if (scale >= 9500 && scale <= 950000) {
scale = Math.round(scale / 1000) + "K";
} else if (scale >= 950000) {
scale = Math.round(scale / 1000000) + "M";
} else {
scale = Math.round(scale / 100) * 100;
}
var scale = res * this.INCHES_PER_UNIT[this.units] * this.dpi;
if (scale >= 9500 && scale <= 950000) {
scale = Math.round(scale / 1000) + "K";
} else if (scale >= 950000) {
scale = Math.round(scale / 1000000) + "M";
} else {
scale = Math.round(scale / 100) * 100;
}
this.element.innerHTML = "Scale = 1 : " + scale;
},