mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 05:26:47 +00:00
d156404b84
Interaction degraded the longer the map was used past zoom 5 and a reload fixed it, which the report traced accurately: admin-1 geometry was fetched for every country whose bounds crossed the viewport, the cache was never evicted, and the whole accumulated set was torn down and rebuilt as one layer on every addition. Panning past Canada or Russia added their geometry to every later rebuild for the rest of the session. Only the countries in view are rendered now, a signature over that set skips the rebuild entirely while panning inside the same countries, and the cache holds a dozen countries, never evicting one that is on screen or still loading. One cause was not in the report and is probably the bigger one: a fresh renderer was constructed on every rebuild. Leaflet registers a renderer as its own map layer and removing the GeoJSON layer does not remove it, so the pane collected an orphaned element per rebuild that kept updating on every pan for the rest of the session, and at the country layer each orphan is a canvas of four times the viewport area. Both renderers are created once per map now. The region layer stays on SVG on purpose. Leaflet's stylesheet only makes SVG paths mouse-transparent, so a canvas container would swallow the clicks meant for the country layer below zoom 5. Closes #1950