🐛 Fix problem creating grid from elements

This commit is contained in:
alonso.torres
2025-12-23 14:33:28 +01:00
parent a57011ec7b
commit 417cd80564
2 changed files with 22 additions and 20 deletions

View File

@@ -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)))

View File

@@ -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)
(ctl/flex-layout? shape)
(api/set-flex-layout shape))
(api/set-layout-data shape))
;; Property not in WASM
nil))))