]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/browse/start.rjs
Destroy OL objects which use the dataLayer before we destroy the layer
[rails.git] / app / views / browse / start.rjs
index c17325ad19c6a94b1b87e245d39ee3fabc8e0f01..8c8d622606c71910156540a8c01cd1f1de3c5afc 100644 (file)
@@ -50,11 +50,6 @@ page << <<EOJ
     if (browseActive) {
       browseActive = false;
 
-      if (browseDataLayer) {
-        browseDataLayer.destroy();
-        browseDataLayer = null; 
-      } 
-
       if (browseSelectControl) {   
         browseSelectControl.destroy();  
         browseSelectControl = null;
@@ -70,6 +65,11 @@ page << <<EOJ
         browseActiveFeature = null; 
       }
 
+      if (browseDataLayer) {
+        browseDataLayer.destroy();
+        browseDataLayer = null; 
+      } 
+
       map.dataLayer.setVisibility(false);
       map.events.unregister("moveend", map, showData);
     }    
@@ -189,7 +189,7 @@ page << <<EOJ
     if (size > 0.25) {
       setStatus("Unable to load: Bounding box size of " + size + " is too large (must be smaller than 0.25)");
     } else {
-      loadGML("/api/0.5/map?bbox=" + projected.toBBOX());
+      loadGML("/api/#{API_VERSION}/map?bbox=" + projected.toBBOX());
     }
   }
 
@@ -393,7 +393,7 @@ page << <<EOJ
     this.link.href = "";
     this.link.innerHTML = "Wait...";
 
-    new Ajax.Request("/api/0.5/" + this.type + "/" + this.feature.osm_id + "/history", {
+    new Ajax.Request("/api/#{API_VERSION}/" + this.type + "/" + this.feature.osm_id + "/history", {
       onComplete: OpenLayers.Function.bind(displayHistory, this)
     });