🐛 Fix missing tiles on page switch and pan/zoom end

This commit is contained in:
Elena Torro 2026-06-22 09:42:53 +02:00
parent 5775e947ad
commit 8b951f3ae4

View File

@ -107,13 +107,14 @@ pub extern "C" fn set_canvas_background(raw_color: u32) -> Result<()> {
#[wasm_error] #[wasm_error]
pub extern "C" fn render(timestamp: i32, flags: u8) -> Result<FrameType> { pub extern "C" fn render(timestamp: i32, flags: u8) -> Result<FrameType> {
with_state!(state, { with_state!(state, {
let render_state = get_render_state();
state.rebuild_touched_tiles(); state.rebuild_touched_tiles();
// Drain the throttled modifier-tile invalidation accumulated // Drain the throttled modifier-tile invalidation accumulated
// since the previous rAF. set_modifiers skips this work during // since the previous rAF. set_modifiers skips this work during
// interactive_transform; we do it once here, with the current // interactive_transform; we do it once here, with the current
// modifier set, so the cost is paid once per rAF rather than // modifier set, so the cost is paid once per rAF rather than
// once per pointer move. // once per pointer move.
if get_render_state().options.is_interactive_transform() { if render_state.options.is_interactive_transform() {
// Collect into an owned Vec to release the immutable borrow on // Collect into an owned Vec to release the immutable borrow on
// `state.shapes` before the mutable `rebuild_modifier_tiles` call. // `state.shapes` before the mutable `rebuild_modifier_tiles` call.
let ids = state.shapes.modifier_ids().to_vec(); let ids = state.shapes.modifier_ids().to_vec();
@ -121,7 +122,8 @@ pub extern "C" fn render(timestamp: i32, flags: u8) -> Result<FrameType> {
state.rebuild_modifier_tiles(&ids)?; state.rebuild_modifier_tiles(&ids)?;
} }
} }
let frame_type = if flags & RenderFlag::Partial as u8 == RenderFlag::Partial as u8 { let is_partial = flags & RenderFlag::Partial as u8 == RenderFlag::Partial as u8;
let frame_type = if is_partial && !render_state.preserve_target_during_render {
state state
.continue_render_loop(timestamp) .continue_render_loop(timestamp)
.map_err(|_| Error::RecoverableError("Error rendering".to_string()))? .map_err(|_| Error::RecoverableError("Error rendering".to_string()))?