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