[openstreetmap/openstreetmap-website] Fix incorrect z-order of dashboard map markers (fixes #6639) (PR #6654)
Minh Nguyễn
notifications at github.com
Wed Dec 31 07:12:31 UTC 2025
@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/3620368503 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251230/0e9990df/attachment.htm>
More information about the rails-dev
mailing list