mapbox-gl-js version: v0.22.0
the raster overlay is visibile at all zoom levels
the raster overlay disappears at certain zoom levels
v.0.21.0 works as expected.
This is a regression from #2667. @anandthakker, can you please take a look?
Took an initial look. The problem was introduced because of the inversion of TilePyramid (now SourceCache) and Sources. Here's what I think is happening:
ImageSource (and VideoSource) both work by yielding a _single_ valid tile, using that to hold the image/video data. This was true before #2667 as well. However, when inverting the SourceCache/Source dependency, I moved the responsibility for listing the currently-visible tile coordinates (getVisibleCoordinates) from Source to SourceCache. (Before this, it was the responsibility of each Source, but pyramid-based sources delegated to TilePyramid#getRenderableIds.)
What's happening now is that the SourceCache is deciding which tiles are renderable and asking the ImageSource for them. Because some (or even most) of the image is currently getting rendered outside of the (non-clipped) tile, when the map is zoomed in, the single tile responsible for holding the image may end up outside of the view, so that SourceCache no longer includes it in the list of renderable tiles.
Possible ways to solve:
getVisibleCoordinates: Transform => Array<TileCoordinate> method. I don't love this: it feels like a hack, and it really seems like transform => visible tiles ought to be a straightforward geometry calculation.@jfirebaugh @lucaswoj thoughts?
I think ImageSource and VideoSource are fundamentally not tile-based sources and it's awkward to treat them as such (was before #2667, even more so now). I'm most interested in solutions that take "tiles" out of the equation for these source types.
I certainly agree in principle / in the long run, but it does seem like this would require some pretty invasive changes in painter / rendering code. Admittedly, I'm very unfamiliar with that part of the codebase, so perhaps this is just my ignorance talking.
I captured some thoughts about refactoring per @jfirebaugh's comment above in #3186
Most helpful comment
I think
ImageSourceandVideoSourceare fundamentally not tile-based sources and it's awkward to treat them as such (was before #2667, even more so now). I'm most interested in solutions that take "tiles" out of the equation for these source types.