From efd6b95ff6e70c75c06854f43b84425a556b62bc Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Wed, 25 Mar 2026 14:39:46 +0100 Subject: [PATCH] :bug: Clear cache canvas on zoom. Teep textures-only invalidation on pan --- render-wasm/src/render.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/render-wasm/src/render.rs b/render-wasm/src/render.rs index 473d8fc006..5a5ddb8ce5 100644 --- a/render-wasm/src/render.rs +++ b/render-wasm/src/render.rs @@ -2802,10 +2802,14 @@ impl RenderState { self.rebuild_tile_index(tree); - // Invalidate the tile texture cache so all tiles are re-rendered, but - // preserve the cache canvas so render_from_cache can still show a scaled - // preview of old content while new tiles load progressively. - self.surfaces.invalidate_tile_cache(); + // Zoom changes world tile size: a partial cache update would mix scales in the + // mosaic and glitch. Same zoom as last finished render (typical pan): drop only + // tile textures and keep the cache canvas for render_from_cache. + if self.zoom_changed() { + self.surfaces.remove_cached_tiles(self.background_color); + } else { + self.surfaces.invalidate_tile_cache(); + } performance::end_measure!("rebuild_tiles_shallow"); }