Change Scale control to use getScale() from map.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1245 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2006-08-16 17:19:28 +00:00
parent 5a68e0ffe0
commit 2e3ff459b2

View File

@@ -13,19 +13,15 @@ OpenLayers.Control.Scale.prototype =
/** @type DOMElement */
element: null,
/** @type String */
units: 'dd',
/**
* @constructor
*
* @param {DOMElement} element
* @param {String} base
*/
initialize: function(element, units) {
initialize: function(element) {
OpenLayers.Control.prototype.initialize.apply(this, arguments);
this.element = element;
if (units) this.units = units;
},
/**
@@ -53,11 +49,9 @@ OpenLayers.Control.Scale.prototype =
*
*/
updateScale: function() {
var res = this.map.getResolution();
if (!res) return;
var scale = this.map.getScale();
if (!scale) return;
var scale = res * OpenLayers.INCHES_PER_UNIT[this.units]
* OpenLayers.DOTS_PER_INCH;
if (scale >= 9500 && scale <= 950000) {
scale = Math.round(scale / 1000) + "K";
} else if (scale >= 950000) {