From 969666b39b47912191714343ed4d5039d770df96 Mon Sep 17 00:00:00 2001 From: Elena Torro Date: Wed, 4 Feb 2026 11:06:39 +0100 Subject: [PATCH] :wrench: Simplify view interaction log message Remove zoom_changed from log output as it's no longer needed for debugging after the tile optimization changes. --- render-wasm/src/main.rs | 6 +---- render-wasm/src/render.rs | 7 +++++- render-wasm/src/shapes.rs | 5 +++- render-wasm/src/shapes/modifiers.rs | 36 +++++++++++------------------ 4 files changed, 25 insertions(+), 29 deletions(-) diff --git a/render-wasm/src/main.rs b/render-wasm/src/main.rs index e8aa0640f7..a1de07e8fe 100644 --- a/render-wasm/src/main.rs +++ b/render-wasm/src/main.rs @@ -301,11 +301,7 @@ pub extern "C" fn set_view_end() { #[cfg(feature = "profile-macros")] { let total_time = performance::get_time() - unsafe { VIEW_INTERACTION_START }; - performance::console_log!( - "[PERF] view_interaction (zoom_changed={}): {}ms", - zoom_changed, - total_time - ); + performance::console_log!("[PERF] view_interaction: {}ms", total_time); } }); } diff --git a/render-wasm/src/render.rs b/render-wasm/src/render.rs index 9815cd1885..4c9bd7f3ae 100644 --- a/render-wasm/src/render.rs +++ b/render-wasm/src/render.rs @@ -2195,7 +2195,11 @@ impl RenderState { * Given a shape, check the indexes and update it's location in the tile set * returns the tiles that have changed in the process. */ - pub fn update_shape_tiles(&mut self, shape: &Shape, tree: ShapesPoolRef) -> HashSet { + pub fn update_shape_tiles( + &mut self, + shape: &Shape, + tree: ShapesPoolRef, + ) -> HashSet { let TileRect(rsx, rsy, rex, rey) = self.get_tiles_for_shape(shape, tree); // Collect old tiles to avoid borrow conflict with remove_shape_at @@ -2447,6 +2451,7 @@ impl RenderState { self.touched_ids.insert(uuid); } + #[allow(dead_code)] pub fn clean_touched(&mut self) { self.touched_ids.clear(); } diff --git a/render-wasm/src/shapes.rs b/render-wasm/src/shapes.rs index 1edb377e35..358e356043 100644 --- a/render-wasm/src/shapes.rs +++ b/render-wasm/src/shapes.rs @@ -1120,7 +1120,10 @@ impl Shape { } /// Returns children in forward (non-reversed) order - useful for layout calculations - pub fn children_ids_iter_forward(&self, include_hidden: bool) -> Box + '_> { + pub fn children_ids_iter_forward( + &self, + include_hidden: bool, + ) -> Box + '_> { if include_hidden { return Box::new(self.children.iter()); } diff --git a/render-wasm/src/shapes/modifiers.rs b/render-wasm/src/shapes/modifiers.rs index 344935a73f..df2da87b3a 100644 --- a/render-wasm/src/shapes/modifiers.rs +++ b/render-wasm/src/shapes/modifiers.rs @@ -430,34 +430,26 @@ pub fn propagate_modifiers( } } } - // let mut layout_reflows_vec: Vec = layout_reflows.into_iter().collect(); + // We sort the reflows so they are processed deepest-first in the + // tree structure. This way we can be sure that the children layouts + // are already reflowed before their parents. + let mut layout_reflows_vec: Vec = + std::mem::take(&mut layout_reflows).into_iter().collect(); + layout_reflows_vec.sort_unstable_by(|id_a, id_b| { + let da = shapes.get_depth(id_a); + let db = shapes.get_depth(id_b); + db.cmp(&da) + }); - // // We sort the reflows so they are process first the ones that are more - // // deep in the tree structure. This way we can be sure that the children layouts - // // are already reflowed. - // layout_reflows_vec.sort_unstable_by(|id_a, id_b| { - // let da = shapes.get_depth(id_a); - // let db = shapes.get_depth(id_b); - // db.cmp(&da) - // }); - - // let mut bounds_temp = bounds.clone(); - // for id in layout_reflows_vec.iter() { - // if reflown.contains(id) { - // continue; - // } - // reflow_shape(id, state, &mut reflown, &mut entries, &mut bounds_temp); - // } - // layout_reflows = HashSet::new(); - - for id in std::mem::take(&mut layout_reflows) { - if reflown.contains(&id) { + for id in &layout_reflows_vec { + if reflown.contains(id) { continue; } - reflow_shape(&id, state, &mut reflown, &mut entries, &mut bounds); + reflow_shape(id, state, &mut reflown, &mut entries, &mut bounds); } } + #[allow(dead_code)] modifiers .iter() .map(|(key, val)| TransformEntry::from_input(*key, *val))