From daac1ca559670b16c7f19e8758978d1b335ad57f Mon Sep 17 00:00:00 2001 From: cmulders Date: Sun, 12 Jul 2015 14:22:20 +0200 Subject: [PATCH] Hardcoded dependency L.CRS.Earth in L.Control.Scale Currently, L.Control.Scale uses hard-coded the L.CRS.Earth.distance function, while this CRS could have been changed by the user in the map creation. Changing this to map.distance will remove this hard-coded dependency adding flexibility, while maintaining the same functionality. --- src/control/Control.Scale.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/control/Control.Scale.js b/src/control/Control.Scale.js index 2dab3100..7e7a4de8 100644 --- a/src/control/Control.Scale.js +++ b/src/control/Control.Scale.js @@ -41,7 +41,7 @@ L.Control.Scale = L.Control.extend({ var map = this._map, y = map.getSize().y / 2; - var maxMeters = L.CRS.Earth.distance( + var maxMeters = map.distance( map.containerPointToLatLng([0, y]), map.containerPointToLatLng([this.options.maxWidth, y]));