mirror of
https://github.com/penpot/penpot.git
synced 2025-06-15 06:01:38 +02:00
🐛 Improve immediate-children helper
This commit is contained in:
parent
caee3160f2
commit
0468b6acca
4 changed files with 21 additions and 14 deletions
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue