mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
🐛 Fix apply structure modifiers to children
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user