Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve most tile pruning/state issues #2007

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mootw
Copy link
Contributor

@mootw mootw commented Jan 6, 2025

fixes #1837

there are still some instances I can get the tiles to not prune when zooming, but i am not sure the exact conditions. it might be related to multi-level zooms, or prune timers? though it seems like they all appropriately callback.

As part of this PR i also looked to add optimistic tile pruning of the parent when all 4 children are loaded, however quickly ran into state consistency issues. This is a simple quick fix to resolve most of the problem, but the tile layer really needs a rewrite as some of the state is held inside of a Manager which cannot call setState when making changes to the tiles, leading to visual bugs, like this one. I tried to add a setState callback, but ran into flutter issues (as it is generally bad practice) to do this.

So as a mostly-fix, I am adding a setState callback, which adds a few more calls to setState, but the performance impact is minimal (meaning only causing a few more widget draws, which isn't a big deal at all, however we should be able to just call setState under the manager and only update when we update the tiles), and not making the widget drawing slower. I did not notice a meaningful difference in the numbe of rendered frames after moving the map/zooming/animating when profiling.

This setState call also conveniently fixes another bug where changing the tileUrl didn't always update the drawing when it finishes loading.

@mootw mootw requested a review from a team January 6, 2025 06:40
@JaffaKetchup JaffaKetchup changed the title resolves 90% of the tile prune state mismatch issues fix: resolve most tile pruning/state issues Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

[BUG] Old tiles remain visible beneath new tiles after zoom until new gesture
1 participant