[openstreetmap/openstreetmap-website] Use map tiles dark mode without leaflet-osm plugin (PR #5397)

Andy Allan notifications at github.com
Wed Dec 18 11:37:16 UTC 2024


@gravitystorm requested changes on this pull request.

I'm very happy to see this work, thanks @hlfan!

The code looks fine to me, but I'm not a javascript expert so maybe there are better ways to write parts.

Two other changes requested:

* Please rework your commits (e.g. using `git rebase -i`) to avoid having the fixup commits (e.g. combine the linting fixes into the original commits)
* There's still a darken filter applied to the map previews - you can see that the colour of the green spaces on the transport dark map are darkened compared to the main map

![Screenshot from 2024-12-18 11-31-42](https://github.com/user-attachments/assets/39e9708d-8a21-456f-824e-80a94601c0e3)

> @@ -52,9 +57,19 @@ L.OSM.Map = L.Map.extend({
       code: "G"
     });
 
-    this.on("layeradd", function (event) {
-      if (this.baseLayers.indexOf(event.layer) >= 0) {
-        this.setMaxZoom(event.layer.options.maxZoom);
+    this.on("layeradd", function ({ layer }) {
+      if (this.baseLayers.indexOf(layer) >= 0) {
+        this.setMaxZoom(layer.options.maxZoom);
+        const container = layer.getContainer();
+        if (!container) return;
+        if (layer.options.schemeClass) container.classList.add(layer.options.schemeClass);
+        const filterRecievers = [container];

minor spelling error - `filterReceivers`

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

Message ID: <openstreetmap/openstreetmap-website/pull/5397/review/2511562149 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20241218/bdda49db/attachment.htm>


More information about the rails-dev mailing list