mirror of
https://github.com/penpot/penpot.git
synced 2025-05-29 06:56:10 +02:00
🐛 Fix restore component restore layout
This commit is contained in:
parent
a2c9d307df
commit
36b78e5e21
2 changed files with 12 additions and 6 deletions
|
@ -581,11 +581,14 @@
|
|||
changes (-> (pcb/empty-changes it)
|
||||
(cll/generate-restore-component ldata component-id library-id page objects))
|
||||
|
||||
page-id
|
||||
(->> changes :redo-changes (keep :page-id) first)
|
||||
|
||||
frames
|
||||
(->> changes :redo-changes (keep :frame-id))]
|
||||
|
||||
(rx/of (dch/commit-changes changes)
|
||||
(ptk/data-event :layout/update {:ids frames}))))))
|
||||
(ptk/data-event :layout/update {:page-id page-id :ids frames}))))))
|
||||
|
||||
|
||||
(defn restore-components
|
||||
|
|
|
@ -97,15 +97,17 @@
|
|||
;; Never call this directly but through the data-event `:layout/update`
|
||||
;; Otherwise a lot of cycle dependencies could be generated
|
||||
(defn- update-layout-positions
|
||||
[{:keys [ids undo-group]}]
|
||||
[{:keys [page-id ids undo-group]}]
|
||||
(ptk/reify ::update-layout-positions
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [objects (dsh/lookup-page-objects state)
|
||||
(let [page-id (or page-id (:current-page-id state))
|
||||
objects (dsh/lookup-page-objects state page-id)
|
||||
ids (->> ids (filter #(contains? objects %)))]
|
||||
(if (d/not-empty? ids)
|
||||
(let [modif-tree (dwm/create-modif-tree ids (ctm/reflow-modifiers))]
|
||||
(rx/of (dwm/apply-modifiers {:modifiers modif-tree
|
||||
(rx/of (dwm/apply-modifiers {:page-id page-id
|
||||
:modifiers modif-tree
|
||||
:stack-undo? true
|
||||
:undo-group undo-group})))
|
||||
(rx/empty))))))
|
||||
|
@ -127,8 +129,9 @@
|
|||
(rx/filter #(d/not-empty? %))
|
||||
(rx/map
|
||||
(fn [data]
|
||||
(let [ids (reduce #(into %1 (:ids %2)) #{} data)]
|
||||
(update-layout-positions {:ids ids}))))
|
||||
(let [page-id (->> data (keep :page-id) first)
|
||||
ids (reduce #(into %1 (:ids %2)) #{} data)]
|
||||
(update-layout-positions {:page-id page-id :ids ids}))))
|
||||
(rx/take-until stopper))))))
|
||||
|
||||
(defn finalize-shape-layout
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue