Feat: Add Viewport Renderer#1464
Conversation
✅ Deploy Preview for afmg ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
This helps significantly on 100k point maps with lots of burgs, rivers, and labels. Performance NotesMeasured against
Chrome trace over scripted pan/zoom sequence:
|
|
Hello and thanks for the contribution! I like the concept, but the code is really messy and unpolished. If we rethink it into a minimal system, then we can try to go with it. |
|
sure i can do some significant polish ! |
|
I mean we need to rethink the concept. E.g. for burg labels/icon we already have a system to hide them based on zoom level, so we can omit them from DOM as well. Can do the same for routes. You solution is overcomplicated, like on zoom 1 I get 812 burgs of group There is also a dependency on labels positions that we currently keep in svg (not in pack data), so #1313 should be completed first to not lose the data on dom recreation. |
|
ahhh thats makes sense! |
|
Yes, would need to start with a proper planning, PRD creation, then architecture scheme and only then to development. |
|
Drafted an AI PRD for the change: It still requires a lot of thinking as it can be done more elegantly, but the idea is clear. |
This PR improves performance on large, dense maps by virtualizing the most expensive SVG layers. Burg labels/icons and routes now render through a viewport-aware renderer, so the live DOM stays much smaller during pan and zoom while preserving normal SVG crispness.
What Changed
ViewportRendererfor burg labels, burg icons, anchors, and routes.Why
Large maps with many cities, labels, nations, and routes were becoming sluggish because pan/zoom had to move and repaint thousands of live SVG nodes. This keeps the interactive map lightweight while keeping exports and editing behavior complete.