]> 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 1ff86cd4efa52468240a57e5e0c7fdfdeebe10c8..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();