mirror of
https://github.com/penpot/penpot.git
synced 2026-08-01 19:06:18 +00:00
🐛 Fix problems with mov-objects
This commit is contained in:
parent
ba211e3cbd
commit
52f699c175
@ -221,28 +221,31 @@
|
|||||||
;; the new destination target parent id.
|
;; the new destination target parent id.
|
||||||
(if (= prev-parent-id parent-id)
|
(if (= prev-parent-id parent-id)
|
||||||
objects
|
objects
|
||||||
(loop [sid shape-id
|
(let [sid shape-id
|
||||||
pid prev-parent-id
|
pid prev-parent-id
|
||||||
objects objects]
|
obj (get objects pid)
|
||||||
(let [obj (get objects pid)]
|
component? (and (:shape-ref obj)
|
||||||
(cond-> objects
|
(= (:type obj) :group)
|
||||||
true
|
(not ignore-touched))]
|
||||||
(update-in [pid :shapes] strip-id sid)
|
|
||||||
|
|
||||||
(and (:shape-ref obj)
|
(-> objects
|
||||||
(= (:type obj) :group)
|
(d/update-in-when [pid :shapes] strip-id sid)
|
||||||
(not ignore-touched))
|
|
||||||
(->
|
(cond-> component?
|
||||||
(update-in [pid :touched]
|
(d/update-when
|
||||||
cph/set-touched-group :shapes-group)
|
pid
|
||||||
(d/dissoc-in [pid :remote-synced?]))))))))
|
#(-> %
|
||||||
|
(update :touched cph/set-touched-group :shapes-group)
|
||||||
|
(dissoc :remote-synced?)))))))))
|
||||||
|
|
||||||
(update-parent-id [objects id]
|
(update-parent-id [objects id]
|
||||||
(assoc-in objects [id :parent-id] parent-id))
|
(-> objects
|
||||||
|
(d/update-when id assoc :parent-id parent-id)))
|
||||||
|
|
||||||
;; Updates the frame-id references that might be outdated
|
;; Updates the frame-id references that might be outdated
|
||||||
(assign-frame-id [frame-id objects id]
|
(assign-frame-id [frame-id objects id]
|
||||||
(let [objects (update objects id assoc :frame-id frame-id)
|
(let [objects (-> objects
|
||||||
|
(d/update-when id assoc :frame-id frame-id))
|
||||||
obj (get objects id)]
|
obj (get objects id)]
|
||||||
(cond-> objects
|
(cond-> objects
|
||||||
;; If we moving frame, the parent frame is the root
|
;; If we moving frame, the parent frame is the root
|
||||||
|
|||||||
@ -181,7 +181,7 @@
|
|||||||
(defn calculate-invalid-targets
|
(defn calculate-invalid-targets
|
||||||
[shape-id objects]
|
[shape-id objects]
|
||||||
(let [result #{shape-id}
|
(let [result #{shape-id}
|
||||||
children (get-in objects [shape-id :shape])
|
children (get-in objects [shape-id :shapes])
|
||||||
reduce-fn (fn [result child-id]
|
reduce-fn (fn [result child-id]
|
||||||
(into result (calculate-invalid-targets child-id objects)))]
|
(into result (calculate-invalid-targets child-id objects)))]
|
||||||
(reduce reduce-fn result children)))
|
(reduce reduce-fn result children)))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user