[openstreetmap/openstreetmap-website] Change heatmap color to linear from 0 to max changes (PR #5833)
Marwin Hochfelsner
notifications at github.com
Fri Mar 21 09:56:13 UTC 2025
@hlfan commented on this pull request.
> @@ -59,9 +60,10 @@ document.addEventListener("DOMContentLoaded", () => {
},
scale: {
color: {
- type: "threshold",
- range: currentTheme === "dark" ? rangeColors : Array.from(rangeColors).reverse(),
- domain: [10, 20, 30, 40]
+ type: "linear",
+ // reverse mutates the array. But with theme changes we must work on the original data.
+ range: currentTheme === "dark" ? rangeColors : Array.from(rangeColors).toReversed(),
Array.toReversed() has only been available in browsers since mid-2023 and wouldn't be needed in combination with Array.from().
I think the previous version was fine enough, `[...rangeColors].reverse()` would also work.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5833#pullrequestreview-2705354645
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5833/review/2705354645 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250321/1936adcf/attachment.htm>
More information about the rails-dev
mailing list