From e4b4f1bd0855fbe938ef8070e4d5af7dd8b478cd Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 21 Oct 2025 09:47:08 +0200 Subject: [PATCH] :sparkles: Removed all_ancestors traversals --- render-wasm/src/render.rs | 17 ---------------- render-wasm/src/shapes.rs | 41 --------------------------------------- 2 files changed, 58 deletions(-) diff --git a/render-wasm/src/render.rs b/render-wasm/src/render.rs index 00c613a54f..81b10d0624 100644 --- a/render-wasm/src/render.rs +++ b/render-wasm/src/render.rs @@ -1792,23 +1792,6 @@ impl RenderState { } } - /// Processes all ancestors of a shape, invalidating their extended rectangles and updating their tiles - /// - /// When a shape changes, all its ancestors need to have their extended rectangles recalculated - /// because they may contain the changed shape. This function: - /// 1. Computes all ancestors of the shape - /// 2. Invalidates the extrect cache for each ancestor - /// 3. Updates the tiles for each ancestor to ensure proper rendering - pub fn process_shape_ancestors( - &mut self, - shape: &Shape, - tree: &mut ShapesPool, - modifiers: &HashMap, - ) { - let ancestors = shape.all_ancestors(tree, false); - self.invalidate_and_update_tiles(&ancestors, tree, modifiers); - } - /// Rebuilds tiles for shapes with modifiers and processes their ancestors /// /// This function applies transformation modifiers to shapes and updates their tiles. diff --git a/render-wasm/src/shapes.rs b/render-wasm/src/shapes.rs index 33dfb266d4..79c9b0a93a 100644 --- a/render-wasm/src/shapes.rs +++ b/render-wasm/src/shapes.rs @@ -959,47 +959,6 @@ impl Shape { } } - /// Returns all ancestor shapes of this shape, traversing up the parent hierarchy - /// - /// This function walks up the parent chain starting from this shape's parent, - /// collecting all ancestor IDs. It stops when it reaches a nil UUID or when - /// an ancestor is hidden (unless include_hidden is true). - /// - /// # Arguments - /// * `shapes` - The shapes pool containing all shapes - /// * `include_hidden` - Whether to include hidden ancestors in the result - /// - /// # Returns - /// A set of ancestor UUIDs in traversal order (closest ancestor first) - pub fn all_ancestors(&self, shapes: &ShapesPool, include_hidden: bool) -> IndexSet { - let mut ancestors = IndexSet::new(); - let mut current_id = self.id; - - // Traverse upwards using parent_id - while let Some(parent_id) = shapes.get(¤t_id).and_then(|s| s.parent_id) { - // If the parent_id is the zero UUID, there are no more ancestors - if parent_id == Uuid::nil() { - break; - } - - // Check if the ancestor is hidden - if let Some(parent) = shapes.get(&parent_id) { - if !include_hidden && parent.hidden() { - break; - } - ancestors.insert(parent_id); - current_id = parent_id; - } else { - // FIXME: This should panic! I've removed it temporarily until - // we fix the problems with shapes without parents. - // panic!("Parent can't be found"); - break; - } - } - - ancestors - } - pub fn get_matrix(&self) -> Matrix { let mut matrix = Matrix::new_identity(); matrix.post_translate(self.left_top());