[openstreetmap/openstreetmap-website] Make search show multiple markers (PR #6235)

Tom Hughes notifications at github.com
Sun Jul 27 09:37:12 UTC 2025


@tomhughes commented on this pull request.



>    }
 
   function showSearchResult() {
-    let marker = $(this).data("marker");
-
-    if (!marker) {
-      const data = $(this).find("a.set_position").data();
-
-      marker = L.marker([data.lat, data.lon], { icon: OSM.getMarker({}) });
-
-      $(this).data("marker", marker);
-    }
-
+    const index = processedResults++;
+    const listItem = $(this);
+    const color = `hwb(${(index * (Math.sqrt(5) - 1) * 180) % 360}deg 5% 5%)`;

This actually appears to be the reciprocal of the golden angle (~222.5 degrees) not the golden angle (~137.5 degrees) at least according to https://en.wikipedia.org/wiki/Golden_angle?

The golden angle would be:

```suggestion
    const color = `hwb(${(index * (3 - Math.sqrt(5) ) * 180) % 360}deg 5% 5%)`;
```

Possibly that calculation should be pulled out to a `goldenAngle` variable that is then used in the template, as a way of documenting what we're doing?

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

Message ID: <openstreetmap/openstreetmap-website/pull/6235/review/3059438187 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250727/e6ba89c9/attachment.htm>


More information about the rails-dev mailing list