]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/browse/_map.html.erb
Refactor bounding box code
[rails.git] / app / views / browse / _map.html.erb
index 6641b0dd71f2e3ea3711aadbae52f23db84cdeb6..4b2093e3f06ce061533fc97995145d3a3561446b 100644 (file)
       });
 
       <% if map.instance_of? Changeset %>
-        var minlon = <%= map.min_lon / GeoRecord::SCALE.to_f %>;
-        var minlat = <%= map.min_lat / GeoRecord::SCALE.to_f %>;
-        var maxlon = <%= map.max_lon / GeoRecord::SCALE.to_f %>;
-        var maxlat = <%= map.max_lat / GeoRecord::SCALE.to_f %>;
+        <% bbox = map.bbox.to_unscaled %>
+        var minlon = <%= bbox.min_lon %>;
+        var minlat = <%= bbox.min_lat %>;
+        var maxlon = <%= bbox.max_lon %>;
+        var maxlat = <%= bbox.max_lat %>;
         var bbox = new OpenLayers.Bounds(minlon, minlat, maxlon, maxlat);
         var centre = bbox.getCenterLonLat();
 
         });
 
         $("remote_area_edit").observe("click", function (event) {
-          remoteEditHandler(event, extent);
+          remoteEditHandler(event, bbox);
         });
 
         <% if preferred_editor == "remote" %>
           $("area_edit").observe("click", function (event) {
-            remoteEditHandler(event, extent);
+            remoteEditHandler(event, bbox);
           });
         <% end %>