fix incorrect calculation of scale by the scale control, closes #852

This commit is contained in:
Vladimir Agafonkin 2012-07-30 16:45:58 +03:00
parent 3773a30726
commit e3b2b78558
3 changed files with 3 additions and 3 deletions

2
dist/leaflet-src.js vendored
View File

@ -6716,7 +6716,7 @@ L.Control.Scale = L.Control.extend({
_update: function () {
var bounds = this._map.getBounds(),
centerLat = bounds.getCenter().lat,
halfWorldMeters = new L.LatLng(centerLat, 0).distanceTo(new L.LatLng(centerLat, 180)),
halfWorldMeters = 6378137 * Math.PI * Math.cos(centerLat * Math.PI / 180),
dist = halfWorldMeters * (bounds.getNorthEast().lng - bounds.getSouthWest().lng) / 180,
size = this._map.getSize(),

2
dist/leaflet.js vendored

File diff suppressed because one or more lines are too long

View File

@ -38,7 +38,7 @@ L.Control.Scale = L.Control.extend({
_update: function () {
var bounds = this._map.getBounds(),
centerLat = bounds.getCenter().lat,
halfWorldMeters = new L.LatLng(centerLat, 0).distanceTo(new L.LatLng(centerLat, 180)),
halfWorldMeters = 6378137 * Math.PI * Math.cos(centerLat * Math.PI / 180),
dist = halfWorldMeters * (bounds.getNorthEast().lng - bounds.getSouthWest().lng) / 180,
size = this._map.getSize(),