Reduce user location to be between -180 and 180 degrees
authorTom Hughes <tom@compton.nu>
Tue, 30 Jul 2013 20:20:09 +0000 (21:20 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 30 Jul 2013 20:20:09 +0000 (21:20 +0100)
app/assets/javascripts/user.js

index b4dbb7d..7de408b 100644 (file)
@@ -24,11 +24,12 @@ $(document).ready(function () {
     map.on("click", function (e) {
       if ($('#updatehome').is(':checked')) {
         var zoom = map.getZoom(),
-            toZoom = zoomPrecision(zoom);
+            toZoom = zoomPrecision(zoom),
+            location = e.latlng.wrap();
 
         $('#homerow').removeClass();
-        $('#home_lat').val(toZoom(e.latlng.lat));
-        $('#home_lon').val(toZoom(e.latlng.lng));
+        $('#home_lat').val(toZoom(location.lat));
+        $('#home_lon').val(toZoom(location.lng));
 
         marker.setLatLng(e.latlng);
         marker.addTo(map);