0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

🐛 Fix parent handling on duplicate.

This commit is contained in:
Andrey Antukh 2020-06-15 12:02:36 +02:00 committed by Hirunatan
parent df7092e2d4
commit 828455ac27
2 changed files with 15 additions and 16 deletions

View file

@ -777,7 +777,7 @@
(us/verify ::us/uuid parent-id) (us/verify ::us/uuid parent-id)
(us/verify number? to-index) (us/verify number? to-index)
(ptk/reify ::relocate-shape (ptk/reify ::relocate-shapes
ptk/WatchEvent ptk/WatchEvent
(watch [_ state stream] (watch [_ state stream]
(let [page-id (:current-page-id state) (let [page-id (:current-page-id state)

View file

@ -197,25 +197,24 @@
fit." fit."
[objects names ids delta] [objects names ids delta]
(loop [names names (loop [names names
chgs [] ids (seq ids)
id (first ids) chgs []]
ids (rest ids)] (if ids
(if (nil? id) (let [id (first ids)
chgs result (prepare-duplicate-change objects names id delta)
(let [result (prepare-duplicate-change objects names id delta)
result (if (vector? result) result [result])] result (if (vector? result) result [result])]
(recur (recur
(into names (map change->name) result) (into names (map change->name) result)
(into chgs result) (next ids)
(first ids) (into chgs result)))
(rest ids)))))) chgs)))
(defn- prepare-duplicate-change (defn- prepare-duplicate-change
[objects names id delta] [objects names id delta]
(let [obj (get objects id)] (let [obj (get objects id)]
(if (= :frame (:type obj)) (if (= :frame (:type obj))
(prepare-duplicate-frame-change objects names obj delta) (prepare-duplicate-frame-change objects names obj delta)
(prepare-duplicate-shape-change objects names obj delta nil nil)))) (prepare-duplicate-shape-change objects names obj delta (:frame-id obj) (:parent-id obj)))))
(defn- prepare-duplicate-shape-change (defn- prepare-duplicate-shape-change
[objects names obj delta frame-id parent-id] [objects names obj delta frame-id parent-id]