mirror of
https://github.com/penpot/penpot.git
synced 2025-03-29 08:01:41 -05:00
🐛 Fix apply structure modifiers to children
This commit is contained in:
parent
3a2e1b5c94
commit
aa4a3ef940
2 changed files with 20 additions and 2 deletions
common/src/app/common
|
@ -322,10 +322,20 @@
|
||||||
|
|
||||||
(defn- apply-structure-modifiers
|
(defn- apply-structure-modifiers
|
||||||
[objects modif-tree]
|
[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
|
(cond-> objects
|
||||||
(ctm/has-structure? modifiers)
|
(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)))
|
(reduce apply-shape objects modif-tree)))
|
||||||
|
|
||||||
(defn merge-modif-tree
|
(defn merge-modif-tree
|
||||||
|
|
|
@ -543,6 +543,10 @@
|
||||||
(or (d/not-empty? structure-parent)
|
(or (d/not-empty? structure-parent)
|
||||||
(d/not-empty? structure-child)))
|
(d/not-empty? structure-child)))
|
||||||
|
|
||||||
|
(defn has-structure-child?
|
||||||
|
[modifiers]
|
||||||
|
(d/not-empty? (dm/get-prop modifiers :structure-child)))
|
||||||
|
|
||||||
;; Extract subsets of modifiers
|
;; Extract subsets of modifiers
|
||||||
|
|
||||||
(defn select-child
|
(defn select-child
|
||||||
|
@ -565,6 +569,10 @@
|
||||||
[modifiers]
|
[modifiers]
|
||||||
(-> modifiers select-child select-geometry))
|
(-> modifiers select-child select-geometry))
|
||||||
|
|
||||||
|
(defn select-child-structre-modifiers
|
||||||
|
[modifiers]
|
||||||
|
(-> modifiers select-child select-structure))
|
||||||
|
|
||||||
(defn added-children-frames
|
(defn added-children-frames
|
||||||
"Returns the frames that have an 'add-children' operation"
|
"Returns the frames that have an 'add-children' operation"
|
||||||
[modif-tree]
|
[modif-tree]
|
||||||
|
|
Loading…
Add table
Reference in a new issue