mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 00:43:15 +00:00
feat(maps): keep GL maps responsive through style and GPU changes
This commit is contained in:
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user