Skip to content

refactor: migrate tile rendering from widgets to CustomPainter #1928

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

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

JaffaKetchup
Copy link
Member

Superceeds #1853 & continues #1908 targeting master.

@ReinisSprogis
Copy link
Contributor

Hi. Any insights on this? That CPU usage is still very high. This was cutting it down by half or more. I don't know if there are any other plans to reduce it.

@JaffaKetchup
Copy link
Member Author

I couldn't find an improvement in performance as big as was suggested on a non-web platform, but I'll go back and see if I can do some more detailed testing (as it wasn't massively detailed before). There wasn't an immediate plan to merge this, but it's definitely something we can consider in the short-to-mid term.

@ReinisSprogis
Copy link
Contributor

It is the WEB platform that has slow performance.

@JaffaKetchup JaffaKetchup marked this pull request as draft September 12, 2024 18:47
@JaffaKetchup
Copy link
Member Author

We're still looking towards potentially merging this, but we will need to just verify that loosing the ability to render widgets over tiles is acceptable. I'm not 100% sure it is without a good workaround.

@ReinisSprogis
Copy link
Contributor

Hi.
I'm currently working on a plugin that requires rendering widgets over tiles. I found that the current custom tileBuilder approach is not ideal. It requires a function that returns a Widget, which makes it easy to implement, but it introduces various issues with state management (Helper methods). Since the widget gets disposed and rebuilt on every map event or state change, maintaining state becomes problematic. To work around this, I ended up creating a new layer that recalculates how tiles are laid out, ensuring synchronization with map tiles based on the MapCamera. However, this results in duplicated logic: the TileLayer does the layout once, and then I recalculate it again in my custom layer. While this approach works, it would be much better if the tile API were exposed in a similar way to MapCamera.

I'm not entirely sure how that would be structured, but if tileBuilder could be replaced or extended to expose visible tiles, their positions, XYZ-key and sizes, it would allow developers to overlay widgets properly. With that you could still use this CustomPainter if desired without loosing the ability to render widgets over tiles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants