@1ec5 commented on this pull request.

This is a functional workaround. I’m inclined to say it could go in for the 
time being. That said, it’s unfortunately making MapLibre’s marker API look 
like a poor fit for any faux 3D pin effect we might one on the main map. If 
this were a symbol layer, interactivity would be less straightforward, but 
fixing the z-ordering issue would be a one-liner. We can track that 
investigation separately. If we do keep this marker-ordering code around 
longer-term, it should live in app/assets/javascripts/maplibre.map.js so other 
maps will be able to use it too.

>            .setPopup(OSM.MapLibre.getPopup(user.description))
           .addTo(map);
-      }
-    });
+
+        return { marker, lat, lon };
+      })
+      .get();
+
+    const updateZIndex = () => {
+      markerObjects.forEach((item) => {
+        item.currentY = map.project([item.lon, item.lat]).y;
+      });
+      markerObjects.sort((a, b) => a.currentY - b.currentY);
+      markerObjects.forEach((item, index) => {

Nit: It looks like other files are using for-of loops instead of `forEach`. 
Maybe we should be consistent for readability.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6654#pullrequestreview-3620368503
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/6654/review/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to