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.
This commit is contained in:
cmulders 2015-07-12 14:22:20 +02:00
parent 265f201433
commit daac1ca559

View File

@ -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]));