mirror of
https://github.com/penpot/penpot.git
synced 2025-01-11 01:10:28 -05:00
Merge pull request #3613 from penpot/hiru-fix-parent-touched
🐛 Fix parent touched detecion when duplicating or copy&paste
This commit is contained in:
commit
3228d0a95f
1 changed files with 6 additions and 4 deletions
|
@ -412,9 +412,9 @@
|
||||||
|
|
||||||
(defn- prepare-duplicate-shape-change
|
(defn- prepare-duplicate-shape-change
|
||||||
([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id]
|
([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id]
|
||||||
(prepare-duplicate-shape-change changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id (:frame-id obj) (:parent-id obj) false))
|
(prepare-duplicate-shape-change changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id (:frame-id obj) (:parent-id obj) false false))
|
||||||
|
|
||||||
([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id frame-id parent-id duplicating-component?]
|
([changes objects page unames update-unames! ids-map obj delta libraries library-data it file-id frame-id parent-id duplicating-component? child?]
|
||||||
(cond
|
(cond
|
||||||
(nil? obj)
|
(nil? obj)
|
||||||
changes
|
changes
|
||||||
|
@ -466,7 +466,8 @@
|
||||||
(not duplicating-component?)
|
(not duplicating-component?)
|
||||||
(dissoc :shape-ref))
|
(dissoc :shape-ref))
|
||||||
|
|
||||||
changes (-> (pcb/add-object changes new-obj {:ignore-touched duplicating-component?})
|
; We want the first added object to touch it's parent, but not subsequent children
|
||||||
|
changes (-> (pcb/add-object changes new-obj {:ignore-touched (and duplicating-component? child?)})
|
||||||
(pcb/amend-last-change #(assoc % :old-id (:id obj))))
|
(pcb/amend-last-change #(assoc % :old-id (:id obj))))
|
||||||
|
|
||||||
changes (cond-> changes
|
changes (cond-> changes
|
||||||
|
@ -488,7 +489,8 @@
|
||||||
file-id
|
file-id
|
||||||
(if frame? new-id frame-id)
|
(if frame? new-id frame-id)
|
||||||
new-id
|
new-id
|
||||||
duplicating-component?))
|
duplicating-component?
|
||||||
|
true))
|
||||||
changes
|
changes
|
||||||
(map (d/getf objects) (:shapes obj)))))))
|
(map (d/getf objects) (:shapes obj)))))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue