]> git.openstreetmap.org Git - rails.git/commitdiff
Wrap longitude values explicitly
authorTom Hughes <tom@compton.nu>
Tue, 22 Jan 2013 22:29:50 +0000 (22:29 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 22 Jan 2013 22:29:50 +0000 (22:29 +0000)
Leaflet 0.5 no longer wraps longitude values, so we need to do it.

app/assets/javascripts/index.js
app/assets/javascripts/map.js.erb

index 847c230b6e77ed3fc44d07fe917f3dedd3f26dcc..e96ffbf02cffa713776da79b0b3864e45e38863b 100644 (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 layers = getMapLayers();
     var zoom = map.getZoom();
     var layers = getMapLayers();
-    var extents = map.getBounds();
+    var extents = map.getBounds().wrap();
 
     updatelinks(center.lng,
                 center.lat,
 
     updatelinks(center.lng,
                 center.lat,
index a18292aaaad74083a26c119d1a206605b2dfb64a..928575eb5312a04ec04d86704ec8fcfcaba6d60b 100644 (file)
@@ -29,6 +29,10 @@ L.extend(L.LatLngBounds.prototype, {
   getSize: function () {
     return (this._northEast.lat - this._southWest.lat) *
            (this._northEast.lng - this._southWest.lng);
   getSize: function () {
     return (this._northEast.lat - this._southWest.lat) *
            (this._northEast.lng - this._southWest.lng);
+  },
+
+  wrap: function () {
+    return new L.LatLngBounds(this._southWest.wrap(), this._northEast.wrap());
   }
 });
 
   }
 });