[openstreetmap/openstreetmap-website] Use class based map tiles dark mode (PR #5505)
Marwin Hochfelsner
notifications at github.com
Thu Jan 16 19:03:31 UTC 2025
@hlfan commented on this pull request.
> @@ -52,10 +57,12 @@ 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) return;
+ this.setMaxZoom(layer.options.maxZoom);
+ const key = document.querySelector(".key-ui");
+ if (!key) return;
+ key.className = "key-ui " + layer.options.className;
I also have to remove the classes from the previously selected layer. And I'd rather do that in a single line without needing a separate function on layerremove.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5505#discussion_r1919056066
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/5505/review/2557017655 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250116/44998e92/attachment.htm>
More information about the rails-dev
mailing list