tangram
tangram copied to clipboard
Cancel pending image loading when tile is out-of-view
TANGRAM VERSION:
All
ENVIRONMENT:
All
TO REPRODUCE THE ISSUE, FOLLOW THESE STEPS:
set network throttling to somethin slow Start fast pan and zoom , fly-to, Look at network connections
RESULT: Tiles that moved out of view still loading, This causing huge network queue and as a result tiles that requested last (most recent and in view) loaded after tiles that does not required for scene rendering, also blocking some interactions EXPECTED RESULT:
not in the view network requests should be canceled (see mapbox for examples)
Thanks for reporting, this is an interesting case. We do have tile cancellation logic, but it turns out that the way tiles are loaded in Tangram, it only works for vector tiles (you can see this in network inspector if you rapidly zoom, for instance).
The reason it doesn't work for raster tiles has to do with how they are implemented in Tangram -- raster tiles are just textures stretched over a simple square tile polygon, and textures are loaded with an entirely different process. Unfortunately, because of the order of operations in that process, and need to communicate the texture load/create process between worker and main threads (WebGL resources can only be allocated on the main thread, and this is part of the texture creation process), there is currently no easy "hook" I can use to add this cancellation.
But it's a good bug to fix, and I am thinking about how we can achieve it.
Any plans about this?