From de04026dc8102e58b37a9c3ea191ea31ec609432 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 31 Oct 2025 11:56:07 +0100 Subject: [PATCH] :sparkles: After review changes --- frontend/src/app/render_wasm/shape.cljs | 12 +++++------- render-wasm/src/shapes.rs | 2 +- render-wasm/src/state/shapes_pool.rs | 24 ------------------------ 3 files changed, 6 insertions(+), 32 deletions(-) diff --git a/frontend/src/app/render_wasm/shape.cljs b/frontend/src/app/render_wasm/shape.cljs index 922240dd29..3af716f0f2 100644 --- a/frontend/src/app/render_wasm/shape.cljs +++ b/frontend/src/app/render_wasm/shape.cljs @@ -259,10 +259,13 @@ (api/update-shape-tiles) (api/request-render "set-wasm-attrs"))))) +;; `conj` empty set initialization +(def conj* (fnil conj #{})) + (defn- impl-assoc [self k v] (when shape/*shape-changes* - (vswap! shape/*shape-changes* update (:id self) (fnil conj #{}) k)) + (vswap! shape/*shape-changes* update (:id self) conj* k)) (case k :id @@ -284,13 +287,8 @@ (defn- impl-dissoc [self k] - #_(when ^boolean shape/*wasm-sync* - (binding [shape/*wasm-sync* false] - (when (shape-in-current-page? (.-id ^ShapeProxy self)) - (set-wasm-attrs! self k nil)))) - (when shape/*shape-changes* - (vswap! shape/*shape-changes* update (:id self) (fnil conj #{}) k)) + (vswap! shape/*shape-changes* update (:id self) conj* k)) (case k :id diff --git a/render-wasm/src/shapes.rs b/render-wasm/src/shapes.rs index adc8235b83..c834d778f6 100644 --- a/render-wasm/src/shapes.rs +++ b/render-wasm/src/shapes.rs @@ -1151,7 +1151,7 @@ impl Shape { pub fn apply_transform(&mut self, transform: &Matrix) { self.transform_selrect(transform); - // We don't need to invalidate this? we can just transform it + // TODO: See if we can change this invalidation to a transformation self.invalidate_extrect(); self.invalidate_bounds(); diff --git a/render-wasm/src/state/shapes_pool.rs b/render-wasm/src/state/shapes_pool.rs index ca91b833d3..f778f5faab 100644 --- a/render-wasm/src/state/shapes_pool.rs +++ b/render-wasm/src/state/shapes_pool.rs @@ -266,8 +266,6 @@ impl<'a> ShapesPoolImpl<'a> { } pub fn set_modifiers(&mut self, modifiers: HashMap) { - // self.clean_shape_cache(); - // Convert HashMap to HashMap<&'a Uuid, V> using references from shapes and // Initialize the cache cells because later we don't want to have the mutable pointer @@ -394,25 +392,3 @@ impl<'a> ShapesPoolImpl<'a> { shape.is_bool() } } - -// fn is_modified_child( -// shape: &Shape, -// shapes: ShapesPoolRef, -// modifiers: &HashMap, -// ) -> bool { -// if modifiers.is_empty() { -// return false; -// } -// -// let ids = shape.all_children(shapes, true, false); -// let default = &Matrix::default(); -// let parent_modifier = modifiers.get(&shape.id).unwrap_or(default); -// -// // Returns true if the transform of any child is different to the parent's -// ids.iter().any(|id| { -// !math::is_close_matrix( -// parent_modifier, -// modifiers.get(id).unwrap_or(&Matrix::default()), -// ) -// }) -// }