From 7d6b3fa0b9b87f6d0ae7588ec18a9dcfd454e0ca Mon Sep 17 00:00:00 2001 From: Schuyler Erle Date: Mon, 19 Feb 2007 22:42:17 +0000 Subject: [PATCH] Control.Scale now correctly reports scales under 1:500. Includes tests. Fixes #503. git-svn-id: http://svn.openlayers.org/trunk/openlayers@2244 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/Scale.js | 5 ++-- tests/list-tests.html | 1 + tests/test_Control_Scale.html | 47 +++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 tests/test_Control_Scale.html diff --git a/lib/OpenLayers/Control/Scale.js b/lib/OpenLayers/Control/Scale.js index de7ee41b07..bde35edfc2 100644 --- a/lib/OpenLayers/Control/Scale.js +++ b/lib/OpenLayers/Control/Scale.js @@ -53,8 +53,9 @@ OpenLayers.Control.Scale.prototype = } else if (scale >= 950000) { scale = Math.round(scale / 1000000) + "M"; } else { - scale = Math.round(scale / 100) * 100; - } + scale = Math.round(scale); + } + this.element.innerHTML = "Scale = 1 : " + scale; }, diff --git a/tests/list-tests.html b/tests/list-tests.html index 40d524a32a..8f2172d2fe 100644 --- a/tests/list-tests.html +++ b/tests/list-tests.html @@ -31,5 +31,6 @@
  • test_Control_PanZoom.html
  • test_Control_PanZoomBar.html
  • test_Control_Permalink.html
  • +
  • test_Control_Scale.html
  • test_Map.html
  • diff --git a/tests/test_Control_Scale.html b/tests/test_Control_Scale.html new file mode 100644 index 0000000000..995247730f --- /dev/null +++ b/tests/test_Control_Scale.html @@ -0,0 +1,47 @@ + + + + + + + Scale
    +
    + +