🐛 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")) (h/call wasm/internal-module "_clear_shape_layout"))
(defn- set-shape-layout (defn- set-shape-layout
[shape objects] [shape]
(clear-layout) (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) (when (ctl/flex-layout? shape)
(set-flex-layout shape)) (set-flex-layout shape))
@ -915,7 +910,7 @@
(perf/end-measure "set-view-box::zoom"))))) (perf/end-measure "set-view-box::zoom")))))
(defn set-object (defn set-object
[objects shape] [shape]
(perf/begin-measure "set-object") (perf/begin-measure "set-object")
(let [shape (svg-filters/apply-svg-derived shape) (let [shape (svg-filters/apply-svg-derived shape)
id (dm/get-prop shape :id) id (dm/get-prop shape :id)
@ -980,7 +975,7 @@
(when (= type :text) (when (= type :text)
(set-shape-grow-type grow-type)) (set-shape-grow-type grow-type))
(set-shape-layout shape objects) (set-shape-layout shape)
(set-shape-selrect selrect) (set-shape-selrect selrect)
(let [pending_thumbnails (into [] (concat (let [pending_thumbnails (into [] (concat
@ -1034,7 +1029,7 @@
(defn process-object (defn process-object
[shape] [shape]
(let [{:keys [thumbnails full]} (set-object [] shape)] (let [{:keys [thumbnails full]} (set-object shape)]
(process-pending [shape] thumbnails full noop-fn))) (process-pending [shape] thumbnails full noop-fn)))
(defn set-objects (defn set-objects
@ -1049,7 +1044,7 @@
(loop [index 0 thumbnails-acc [] full-acc []] (loop [index 0 thumbnails-acc [] full-acc []]
(if (< index total-shapes) (if (< index total-shapes)
(let [shape (nth shapes index) (let [shape (nth shapes index)
{:keys [thumbnails full]} (set-object objects shape)] {:keys [thumbnails full]} (set-object shape)]
(recur (inc index) (recur (inc index)
(into thumbnails-acc thumbnails) (into thumbnails-acc thumbnails)
(into full-acc full))) (into full-acc full)))

View File

@ -280,8 +280,18 @@
:layout-grid-cells :layout-grid-cells
(api/set-grid-layout-cells v) (api/set-grid-layout-cells v)
(:layout :layout
:layout-flex-dir (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-type
:layout-gap :layout-gap
:layout-align-items :layout-align-items
@ -291,15 +301,12 @@
:layout-wrap-type :layout-wrap-type
:layout-padding-type :layout-padding-type
:layout-padding) :layout-padding)
(do (cond
(api/clear-layout) (ctl/grid-layout? shape)
(cond (api/set-grid-layout-data shape)
(ctl/grid-layout? shape)
(api/set-grid-layout-data shape)
(ctl/flex-layout? shape) (ctl/flex-layout? shape)
(api/set-flex-layout shape)) (api/set-flex-layout shape))
(api/set-layout-data shape))
;; Property not in WASM ;; Property not in WASM
nil)))) nil))))