[openstreetmap/openstreetmap-website] Unable to disable "Map Notes" overlay on low zoom (Issue #6358)

Kai Michael Poppe notifications at github.com
Mon Sep 14 06:53:57 UTC 2026


kmpoppe left a comment (openstreetmap/openstreetmap-website#6358)

Good morning,

fiddled around with the javascript responsible for this behaviour, let me take you on a "wild ride" (as far as programming can go):
* ever since November 2013 (439ad37), the disabling of the Layer checkboxes occurred in the `map.on("zoomed")` function, thus reloading the page in a zoom level higher than what was allowed for the Layers didn't disable them.
* fbedc95dfa6db20c9f08d542d033ce771f5545a7 changed the behaviour of Layer deactivation on zoom to a `input.click()` from `$(input).prop("checked", true).trigger("change")` which broke the functionality, as the checkbox was disabled prior to that and .click() on a disabled object doesn't do anything.

I've now come up with a fix that does the following:
* move detection of Layer Checkbox disabling to a separate function
* give this function an "only disable the checkbox when it's not currently active" gate
* call this function on load, when zooming AND when a Layer was added or removed

What this does is:
* It never allows activating a Layer when outside of it's allowed BoundingBox
* It does NOT restore the behaviour broken in fbedc95dfa6db20c9f08d542d033ce771f5545a7, which deactivated a Layer once it was out of it's aBB
* It DOES allow deactivating a Layer when it's currently active, even outside of it's aBB.

Please see d2b20f4, I'd like to hear your thoughts on this idea of a fix.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/6358#issuecomment-5660166538
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/6358/5660166538 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260913/bdb6af38/attachment.htm>


More information about the rails-dev mailing list