[fix] Layers not clipped on change from control layer + iOS buggy interactions - #34
Open
ahmed-machine wants to merge 4 commits into
Open
[fix] Layers not clipped on change from control layer + iOS buggy interactions#34ahmed-machine wants to merge 4 commits into
ahmed-machine wants to merge 4 commits into
Conversation
…control layer. Resolve iOS safari not redrawing on drag/move by forcing it to redraw with the updated style changes Cleanup
|
Tried this. It breaks the range events and no layer is visible. Using Chrome, leaflet 1.9.4 (I did replace getContainer with getPane) |
ahmed-machine
force-pushed
the
gh-pages
branch
from
August 29, 2025 20:12
d9a244c to
25f374d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you again for this wonderful library! I've been using it on my website and wanted to push some fixes. Since this isn't actively maintained, I merged the two fixes into one PR to make it easier for someone to copy the code for their site.
Issue: Changing the overlay or base layer via the control layer resulted in both layers not clipping and appearing on both sides of the divider
This was caused by the new layer not being included in
this._leftLayersorthis._rightLayerswhich resulted inthis._leftLayerorthis._rightLayerbeing set tonullbut never getting set again. A null layer would be skipped in_updateClip. I resolved it by adding event handlers tooverlayaddandbaselayerchangethat updatethis._leftLayerorthis._rightLayerto the new layer and then add it tothis._leftLayersorthis._rightLayersrespectively. This allows it to be successfully set and later clipped in_updateClip.Issue: Leaflet side-by-side not redrawing on drag/move on iOS or requiring 2 fingers to pan or both sides of the map moving independently from the other
This was caused by two issues. iOS handles
touchenddifferently from other platforms. I resolved it by adding an event listener ontouchmoveinstead. This leaves the issue of drag working but only updating one layer until we trigger a redraw by moving the divider or using two fingers to zoom. TheclipCSS property was getting set correctly, but iOS Safari/Webkit didn't trigger a redraw of the element when the style property got changed. I resolved it by forcing Safari to redraw with a crude hack (gleaned from this useful page):