From 76ec610d440a2eace64083b67e354c4a85bafb9c Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Thu, 30 Nov 2023 11:57:21 +0100 Subject: [PATCH] :bug: Fix you can move a shape outside of a copy --- common/src/app/common/files/changes.cljc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/src/app/common/files/changes.cljc b/common/src/app/common/files/changes.cljc index f6ed606233..5816177a0c 100644 --- a/common/src/app/common/files/changes.cljc +++ b/common/src/app/common/files/changes.cljc @@ -477,12 +477,16 @@ ;; or inside its main component if it's in a copy, ;; or inside a copy (is-valid-move? [objects shape-id] - (let [invalid-targets (calculate-invalid-targets objects shape-id)] - (and (contains? objects shape-id) + (let [invalid-targets (calculate-invalid-targets objects shape-id) + shape (get objects shape-id) + _ (prn "is-valid-move?")] + (and shape (not (invalid-targets parent-id)) (not (cfh/components-nesting-loop? objects shape-id parent-id)) (or component-swap - (not (ctk/in-component-copy? (get objects parent-id))))))) ;; We don't want to change the structure of component copies + (and + (not (ctk/in-component-copy? (get objects (:parent-id shape)))) ;; We don't want to change the structure of component copies + (not (ctk/in-component-copy? (get objects parent-id)))))))) ;; We need to check the origin and target frames (insert-items [prev-shapes index shapes] (let [prev-shapes (or prev-shapes [])]