[openstreetmap/openstreetmap-website] Consolidate leaflet marker creation in OSM.getMarker (PR #5860)
Marwin Hochfelsner
notifications at github.com
Sat Mar 29 00:14:29 UTC 2025
@hlfan commented on this pull request.
> - iconAnchor: [12, 41],
- popupAnchor: [1, -34],
- shadowUrl: OSM.MARKER_SHADOW,
- shadowSize: [41, 41]
- });
+OSM.getMarker = function ({ icon = "MARKER_RED", shadow = true }) {
+ const height = icon.includes("NOTE") ? 40 : 41;
+ const options = {
+ iconUrl: OSM[icon.toUpperCase()] || OSM.MARKER_RED,
+ iconSize: [25, height],
+ iconAnchor: [12, height],
+ popupAnchor: [1, -34]
+ };
+ if (shadow) {
+ options.shadowUrl = OSM.MARKER_SHADOW;
+ options.shadowSize = [41, 41];
The size of the PNG doesn't change just because the marker does. [`shadowAnchor`](https://leafletjs.com/reference.html#icon-shadowanchor) shouldn't change either, so it needs to be specified separately.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5860#discussion_r2019609762
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5860/review/2727097069 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250328/389f9d32/attachment.htm>
More information about the rails-dev
mailing list