🐛 Improve immediate-children helper

This commit is contained in:
alonso.torres 2023-10-06 12:18:06 +02:00
parent caee3160f2
commit 0468b6acca
4 changed files with 21 additions and 14 deletions

View file

@ -41,9 +41,11 @@
(remove :hidden))
bounds (d/lazy-map (keys objects) #(dm/get-in objects [% :points]))
children+bounds (->> children (map (fn [shape] [@(get bounds (:id shape)) shape])))
grid-layout-data
(when (ctl/grid-layout? shape)
(gsg/calc-layout-data shape (:points shape) children bounds objects))
(gsg/calc-layout-data shape (:points shape) children+bounds bounds objects))
layout-bounds
(cond (ctl/flex-layout? shape)

View file

@ -748,10 +748,10 @@
objects (-> objects
(gsh/apply-objects-modifiers (select-keys modifiers ids))
(gsh/update-shapes-geometry (reverse ids)))]
(->> (:shapes shape)
(map (d/getf objects))
(remove :hidden)
(map #(vector (gpo/parent-coords-bounds (:points %) (:points shape)) %))))))
(->> (cph/get-immediate-children objects (:id shape))
(keep (fn [child]
(when-not (:hidden child)
[(gpo/parent-coords-bounds (:points child) (:points shape)) child])))))))
children (hooks/use-equal-memo children)