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:
parent
265f201433
commit
daac1ca559
@ -41,7 +41,7 @@ L.Control.Scale = L.Control.extend({
|
|||||||
var map = this._map,
|
var map = this._map,
|
||||||
y = map.getSize().y / 2;
|
y = map.getSize().y / 2;
|
||||||
|
|
||||||
var maxMeters = L.CRS.Earth.distance(
|
var maxMeters = map.distance(
|
||||||
map.containerPointToLatLng([0, y]),
|
map.containerPointToLatLng([0, y]),
|
||||||
map.containerPointToLatLng([this.options.maxWidth, y]));
|
map.containerPointToLatLng([this.options.maxWidth, y]));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user