[openstreetmap/openstreetmap-website] Use baselayerchange/overlaylayerchange instead of layeradd/layerremove (PR #5474)

Anton Khorev notifications at github.com
Thu Jan 16 13:53:20 UTC 2025


@AntonKhorev requested changes on this pull request.



>          this.addLayer(this.baseLayers[i]);
       } else {
+        baselayerChanged = this.hasLayer(this.baseLayers[i]);

`baselayerchange` is supposed to be fired *once* for the layer that became visible. It's not supposed to be fired for removed layers. See that `null` in Leafet code?
https://github.com/Leaflet/Leaflet/blob/c511e66c20dce06ac05c43cf287b3ecdba00d924/src/control/Control.Layers.js#L317-L319

"This event would be triggered after the other layer events, and it would include a layer property set to the resulting base layer." https://github.com/Leaflet/Leaflet/pull/1064

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

Message ID: <openstreetmap/openstreetmap-website/pull/5474/review/2556220374 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250116/cb8659fd/attachment.htm>


More information about the rails-dev mailing list