feat(maps): keep GL maps responsive through style and GPU changes

This commit is contained in:
Maurice
2026-11-30 16:24:49 +01:00
parent 69eacd5316
commit f814b0000d
24 changed files with 524 additions and 50 deletions
+2 -1
View File
@@ -78,7 +78,7 @@ function isWatchable(map: unknown): map is WatchedMap {
* calls this for every map it builds). Any other style is left alone. Stops on
* its own once a tile arrived, the template was marked, or the map is removed.
*/
export function watchRasterHealth(map: unknown, style: unknown): void {
export function watchRasterHealth(map: unknown, style: unknown): (() => void) | undefined {
if (!isGlRasterStyle(style) || !isWatchable(map)) return;
const template = style.metadata['trek:template'];
const origins = tileOrigins(style.sources[GL_BASEMAP_SOURCE]?.tiles ?? []);
@@ -106,6 +106,7 @@ export function watchRasterHealth(map: unknown, style: unknown): void {
if (failures >= FIRST_TILES) settle(true);
});
map.once('remove', () => settle(false));
return () => settle(false);
}
/** Test seam: a fresh session. */