]> git.openstreetmap.org Git - rails.git/commitdiff
Remove unnecessary abstraction around rectangles
authorTom MacWright <tom@macwright.org>
Mon, 10 Jun 2013 19:46:48 +0000 (12:46 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Thu, 18 Jul 2013 17:31:20 +0000 (10:31 -0700)
app/assets/javascripts/browse.js
app/assets/javascripts/index.js
app/assets/javascripts/map.js.erb

index 24fe5171e50968d2b3f6e78e567974375d0e5843..a5738e1ba7f449ad93c4070e63f43f0f30cd6531 100644 (file)
@@ -33,7 +33,12 @@ $(document).ready(function () {
                               [params.maxlat, params.maxlon]);
 
     map.fitBounds(bbox);
-    addBoxToMap(bbox);
+
+    L.rectangle(bbox, {
+      weight: 2,
+      color: '#e90',
+      fillOpacity: 0
+    }).addTo(map);
 
     $("#loading").hide();
     $("#browse_map .geolink").show();
index 0e3e7cd563f433e84150451b61269409f50b29ee..8d3a043d6f8e00a47d9281b7166a4bec5f2b9cb7 100644 (file)
@@ -48,7 +48,11 @@ $(document).ready(function () {
       map.fitBounds(bbox);
 
       if (params.box) {
-        addBoxToMap(bbox);
+        L.rectangle(bbox, {
+          weight: 2,
+          color: '#e90',
+          fillOpacity: 0
+        }).addTo(map);
       }
     } else {
       map.setView([params.lat, params.lon], params.zoom);
index 80e77f26ca7af5e5969c8bd4200962283e0a14f6..b3ac299f0ef627f5afe4ebe4d55c7a561cb1db78 100644 (file)
@@ -151,18 +151,6 @@ function addObjectToMap(object, options) {
   });
 }
 
-function addBoxToMap(bounds) {
-  var box = L.rectangle(bounds, {
-    weight: 2,
-    color: '#e90',
-    fillOpacity: 0
-  });
-
-  box.addTo(map);
-
-  return box;
-}
-
 function getMapBaseLayer() {
   for (var i = 0; i < layers.length; i++) {
     if (map.hasLayer(layers[i].layer)) {