0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-25 14:11:33 -05:00

🐛 Fix apply structure modifiers to children

This commit is contained in:
alonso.torres 2023-03-14 11:01:26 +01:00
parent 3a2e1b5c94
commit aa4a3ef940
2 changed files with 20 additions and 2 deletions

View file

@ -322,10 +322,20 @@
(defn- apply-structure-modifiers
[objects modif-tree]
(letfn [(apply-shape [objects [id {:keys [modifiers]}]]
(letfn [(update-children-structure-modifiers
[objects ids modifiers]
(reduce #(update %1 %2 ctm/apply-structure-modifiers modifiers) objects ids))
(apply-shape [objects [id {:keys [modifiers]}]]
(cond-> objects
(ctm/has-structure? modifiers)
(update id ctm/apply-structure-modifiers modifiers)))]
(update id ctm/apply-structure-modifiers modifiers)
(and (ctm/has-structure? modifiers)
(ctm/has-structure-child? modifiers))
(update-children-structure-modifiers
(cph/get-children-ids objects id)
(ctm/select-child-structre-modifiers modifiers))))]
(reduce apply-shape objects modif-tree)))
(defn merge-modif-tree

View file

@ -543,6 +543,10 @@
(or (d/not-empty? structure-parent)
(d/not-empty? structure-child)))
(defn has-structure-child?
[modifiers]
(d/not-empty? (dm/get-prop modifiers :structure-child)))
;; Extract subsets of modifiers
(defn select-child
@ -565,6 +569,10 @@
[modifiers]
(-> modifiers select-child select-geometry))
(defn select-child-structre-modifiers
[modifiers]
(-> modifiers select-child select-structure))
(defn added-children-frames
"Returns the frames that have an 'add-children' operation"
[modif-tree]