🐛 Fix invalid frame-id when adding shape to copy

This commit is contained in:
Andrés Moya 2023-12-15 13:53:53 +01:00 committed by Andrey Antukh
parent 41287d8fc5
commit 2fc6290c8f
2 changed files with 15 additions and 8 deletions

View file

@ -354,21 +354,24 @@
the order of the children of each parent." the order of the children of each parent."
([object parent-id objects] ([object parent-id objects]
(clone-object object parent-id objects (fn [object _] object) (fn [object _] object) nil false nil)) (clone-object object parent-id objects (fn [object _] object) (fn [object _] object) nil false nil objects))
([object parent-id objects update-new-object] ([object parent-id objects update-new-object]
(clone-object object parent-id objects update-new-object (fn [object _] object) nil false nil)) (clone-object object parent-id objects update-new-object (fn [object _] object) nil false nil objects))
([object parent-id objects update-new-object update-original-object] ([object parent-id objects update-new-object update-original-object]
(clone-object object parent-id objects update-new-object update-original-object nil false nil)) (clone-object object parent-id objects update-new-object update-original-object nil false nil objects))
([object parent-id objects update-new-object update-original-object force-id] ([object parent-id objects update-new-object update-original-object force-id]
(clone-object object parent-id objects update-new-object update-original-object force-id false nil)) (clone-object object parent-id objects update-new-object update-original-object force-id false nil objects))
([object parent-id objects update-new-object update-original-object force-id keep-ids?] ([object parent-id objects update-new-object update-original-object force-id keep-ids?]
(clone-object object parent-id objects update-new-object update-original-object force-id keep-ids? nil)) (clone-object object parent-id objects update-new-object update-original-object force-id keep-ids? nil objects))
([object parent-id objects update-new-object update-original-object force-id keep-ids? frame-id] ([object parent-id objects update-new-object update-original-object force-id keep-ids? frame-id]
(clone-object object parent-id objects update-new-object update-original-object force-id keep-ids? frame-id objects))
([object parent-id objects update-new-object update-original-object force-id keep-ids? frame-id dest-objects]
(let [new-id (cond (let [new-id (cond
(some? force-id) force-id (some? force-id) force-id
keep-ids? (:id object) keep-ids? (:id object)
@ -378,11 +381,11 @@
;; or the parent's frame-id otherwise. Only for the first cloned shapes. In recursive calls ;; or the parent's frame-id otherwise. Only for the first cloned shapes. In recursive calls
;; this is not needed. ;; this is not needed.
frame-id (cond frame-id (cond
(and (nil? frame-id) (cfh/frame-shape? objects parent-id)) (and (nil? frame-id) (cfh/frame-shape? dest-objects parent-id))
parent-id parent-id
(nil? frame-id) (nil? frame-id)
(dm/get-in objects [parent-id :frame-id]) (dm/get-in dest-objects [parent-id :frame-id] uuid/zero)
:else :else
frame-id)] frame-id)]

View file

@ -980,7 +980,11 @@
(:id parent-shape) (:id parent-shape)
(get component-page :objects) (get component-page :objects)
update-new-shape update-new-shape
update-original-shape) update-original-shape
nil
false
nil
(:objects container))
add-obj-change (fn [changes shape'] add-obj-change (fn [changes shape']
(update changes :redo-changes conj (update changes :redo-changes conj