From 417cd80564f3c912fc53ac151a3df7b35fcd0699 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 23 Dec 2025 14:33:28 +0100 Subject: [PATCH] :bug: Fix problem creating grid from elements --- frontend/src/app/render_wasm/api.cljs | 15 +++++--------- frontend/src/app/render_wasm/shape.cljs | 27 ++++++++++++++++--------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/frontend/src/app/render_wasm/api.cljs b/frontend/src/app/render_wasm/api.cljs index 5628e9aee4..50a33b7d14 100644 --- a/frontend/src/app/render_wasm/api.cljs +++ b/frontend/src/app/render_wasm/api.cljs @@ -758,13 +758,8 @@ (h/call wasm/internal-module "_clear_shape_layout")) (defn- set-shape-layout - [shape objects] + [shape] (clear-layout) - (when (or (ctl/any-layout? shape) - (ctl/any-layout-immediate-child? objects shape) - (has-any-layout-prop? shape)) - (set-layout-data shape)) - (when (ctl/flex-layout? shape) (set-flex-layout shape)) @@ -915,7 +910,7 @@ (perf/end-measure "set-view-box::zoom"))))) (defn set-object - [objects shape] + [shape] (perf/begin-measure "set-object") (let [shape (svg-filters/apply-svg-derived shape) id (dm/get-prop shape :id) @@ -980,7 +975,7 @@ (when (= type :text) (set-shape-grow-type grow-type)) - (set-shape-layout shape objects) + (set-shape-layout shape) (set-shape-selrect selrect) (let [pending_thumbnails (into [] (concat @@ -1034,7 +1029,7 @@ (defn process-object [shape] - (let [{:keys [thumbnails full]} (set-object [] shape)] + (let [{:keys [thumbnails full]} (set-object shape)] (process-pending [shape] thumbnails full noop-fn))) (defn set-objects @@ -1049,7 +1044,7 @@ (loop [index 0 thumbnails-acc [] full-acc []] (if (< index total-shapes) (let [shape (nth shapes index) - {:keys [thumbnails full]} (set-object objects shape)] + {:keys [thumbnails full]} (set-object shape)] (recur (inc index) (into thumbnails-acc thumbnails) (into full-acc full))) diff --git a/frontend/src/app/render_wasm/shape.cljs b/frontend/src/app/render_wasm/shape.cljs index 0ae88e07c1..6475fb9e2f 100644 --- a/frontend/src/app/render_wasm/shape.cljs +++ b/frontend/src/app/render_wasm/shape.cljs @@ -280,8 +280,18 @@ :layout-grid-cells (api/set-grid-layout-cells v) - (:layout - :layout-flex-dir + :layout + (do + (api/clear-layout) + (cond + (ctl/grid-layout? shape) + (api/set-grid-layout shape) + + (ctl/flex-layout? shape) + (api/set-flex-layout shape)) + (api/set-layout-data shape)) + + (:layout-flex-dir :layout-gap-type :layout-gap :layout-align-items @@ -291,15 +301,12 @@ :layout-wrap-type :layout-padding-type :layout-padding) - (do - (api/clear-layout) - (cond - (ctl/grid-layout? shape) - (api/set-grid-layout-data shape) + (cond + (ctl/grid-layout? shape) + (api/set-grid-layout-data shape) - (ctl/flex-layout? shape) - (api/set-flex-layout shape)) - (api/set-layout-data shape)) + (ctl/flex-layout? shape) + (api/set-flex-layout shape)) ;; Property not in WASM nil))))