diff --git a/lib/OpenLayers/Control/Scale.js b/lib/OpenLayers/Control/Scale.js index 682e23d35c..7e023a4fb4 100644 --- a/lib/OpenLayers/Control/Scale.js +++ b/lib/OpenLayers/Control/Scale.js @@ -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; }, diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 43c74d46d9..f4697ea139 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -882,7 +882,7 @@ OpenLayers.Map.prototype = { * @type OpenLayers.LonLat */ getLonLatFromPixel: function (px) { - return this.getLonLatFromViewPortPx(px); + return this.getLonLatFromViewPortPx(px); }, /** @@ -894,7 +894,7 @@ OpenLayers.Map.prototype = { * @type OpenLayers.Pixel */ getPixelFromLonLat: function (lonlat) { - return this.getViewPortPxFromLonLat(lonlat); + return this.getViewPortPxFromLonLat(lonlat); }, diff --git a/tests/test_Map.html b/tests/test_Map.html index 5311bfadfc..74fbfb3c11 100644 --- a/tests/test_Map.html +++ b/tests/test_Map.html @@ -80,14 +80,14 @@ map.zoomOut(); t.eq( map.getZoom(), 0, "map.zoom is correct after calling setCenter,zoom in, zoom out"); - map.zoomTo(5); - t.eq( map.getZoom(), 5, "map.zoom is correct after calling zoomTo" ); + map.zoomTo(5); + t.eq( map.getZoom(), 5, "map.zoom is correct after calling zoomTo" ); /** - map.zoomToMaxExtent(); - t.eq( map.getZoom(), 2, "map.zoom is correct after calling zoomToFullExtent" ); - var lonlat = map.getCenter(); - var zero = new OpenLayers.LonLat(0, 0); - t.ok( lonlat.equals(zero), "map center is correct after calling zoomToFullExtent" ); + map.zoomToMaxExtent(); + t.eq( map.getZoom(), 2, "map.zoom is correct after calling zoomToFullExtent" ); + var lonlat = map.getCenter(); + var zero = new OpenLayers.LonLat(0, 0); + t.ok( lonlat.equals(zero), "map center is correct after calling zoomToFullExtent" ); */ }