fix: wind field no longer goes blank when panning a rotated map#1097
Draft
msupino wants to merge 2 commits into
Draft
fix: wind field no longer goes blank when panning a rotated map#1097msupino wants to merge 2 commits into
msupino wants to merge 2 commits into
Conversation
On a rotated map leaflet-velocity re-projects onto a stale canvas position after a pan/zoom and redraws an empty field. Recreate the layer (buildLayer, same path as the initial render) on moveend/zoomend/rotate/ rotateend while the map is rotated; north-up moves keep Leaflet's native handling (no particle reset). New test pans a rotated map and asserts the field stays drawn. Full suite 982 passed.
Contributor
🚀 Preview deployed
Commit: |
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.
Follow-up to #1094 (positions + direction on rotated maps, already merged to dev).
Bug: with the map rotated, panning/zooming made the wind field vanish and stay blank.
Cause: leaflet-velocity re-projects onto a stale canvas position after a move and redraws an empty field (the canvas element stays, but nothing is drawn). Clean re-positioning doesn't restore it; only a fresh field build does.
Fix: extract
buildLayer()(the initial-render path) and recreate the layer onmoveend/zoomend/rotate/rotateendwhile the map is rotated. North-up moves keep Leaflet's native handling (no particle reset). rAF-coalesced so a dial drag rebuilds once per frame.Test: pan a rotated map, assert the velocity canvas still has drawn pixels (was 0). Full suite 982 passed.