Wrap longitude values explicitly

Leaflet 0.5 no longer wraps longitude values, so we need to do it.
This commit is contained in:
Tom Hughes 2013-01-22 22:29:50 +00:00
parent 08dba25d7a
commit f612f573f9
2 changed files with 6 additions and 2 deletions

View file

@ -65,10 +65,10 @@ $(document).ready(function () {
}); });
function updateLocation() { function updateLocation() {
var center = map.getCenter(); var center = map.getCenter().wrap();
var zoom = map.getZoom(); var zoom = map.getZoom();
var layers = getMapLayers(); var layers = getMapLayers();
var extents = map.getBounds(); var extents = map.getBounds().wrap();
updatelinks(center.lng, updatelinks(center.lng,
center.lat, center.lat,

View file

@ -29,6 +29,10 @@ L.extend(L.LatLngBounds.prototype, {
getSize: function () { getSize: function () {
return (this._northEast.lat - this._southWest.lat) * return (this._northEast.lat - this._southWest.lat) *
(this._northEast.lng - this._southWest.lng); (this._northEast.lng - this._southWest.lng);
},
wrap: function () {
return new L.LatLngBounds(this._southWest.wrap(), this._northEast.wrap());
} }
}); });