]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/browse.js
Make sure the object layer is kept in front of the data layer
[rails.git] / app / assets / javascripts / index / browse.js
index b6a388d81676b6af2cb9d5695c2642359921f820..1140515f5629b93ebd8b04079b806d69493fd5cb 100644 (file)
@@ -1,6 +1,5 @@
 OSM.initializeBrowse = function (map) {
   var browseBounds;
-  var selectedLayer;
   var dataLayer = map.dataLayer;
 
   dataLayer.setStyle({
@@ -92,7 +91,6 @@ OSM.initializeBrowse = function (map) {
       url: url,
       success: function (xml) {
         dataLayer.clearLayers();
-        selectedLayer = null;
 
         var features = dataLayer.buildFeatures(xml);
 
@@ -112,24 +110,16 @@ OSM.initializeBrowse = function (map) {
           displayFeatureWarning(features.length, maxFeatures, addFeatures, cancelAddFeatures);
         }
 
+        if (map._objectLayer) {
+          map._objectLayer.bringToFront();
+        }
+
         dataLoader = null;
       }
     });
   }
 
   function onSelect(layer) {
-    // Unselect previously selected feature
-    if (selectedLayer) {
-      selectedLayer.setStyle(selectedLayer.originalStyle);
-    }
-
-    // Redraw in selected style
-    layer.originalStyle = layer.options;
-    layer.setStyle({ color: "#0000ff", weight: 8 });
-
     OSM.router.route("/" + layer.feature.type + "/" + layer.feature.id);
-
-    // Stash the currently drawn feature
-    selectedLayer = layer;
   }
 };