0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 08:20:45 -05:00

🐛 Fix problem with order of operations

This commit is contained in:
alonso.torres 2024-03-18 15:40:46 +01:00
parent 8363b86cfa
commit 0590336c71
2 changed files with 14 additions and 8 deletions

View file

@ -546,10 +546,7 @@
:layout-padding-type
:layout-gap
:layout-item-margin
:layout-item-margin-type
:layout-grid-cells
:layout-grid-columns
:layout-grid-rows]})
:layout-item-margin-type]})
;; We've applied the text-modifier so we can dissoc the temporary data
(fn [state]
(update state :workspace-text-modifier #(apply dissoc % ids)))

View file

@ -606,11 +606,11 @@
(->> move-stream
(rx/last)
(rx/mapcat
(fn [[_ target-frame drop-index]]
(fn [[_ target-frame drop-index cell-data]]
(let [undo-id (js/Symbol)]
(rx/of (dwu/start-undo-transaction undo-id)
(move-shapes-to-frame ids target-frame drop-index)
(dwm/apply-modifiers {:undo-transation? false})
(move-shapes-to-frame ids target-frame drop-index cell-data)
(finish-transform)
(dwu/commit-undo-transaction undo-id))))))))))))))
@ -832,7 +832,7 @@
:ignore-snap-pixel true}))))))
(defn- move-shapes-to-frame
[ids frame-id drop-index]
[ids frame-id drop-index [row column :as cell]]
(ptk/reify ::move-shapes-to-frame
ptk/WatchEvent
(watch [it state _]
@ -924,7 +924,16 @@
(pcb/update-shapes shape-ids-to-detach ctk/detach-shape)
(pcb/change-parent frame-id moving-shapes drop-index)
(cond-> (ctl/grid-layout? objects frame-id)
(-> (pcb/update-shapes [frame-id] ctl/assign-cell-positions {:with-objects? true})
(-> (pcb/update-shapes
[frame-id]
(fn [frame objects]
(-> frame
;; Assign the cell when pushing into a specific grid cell
(cond-> (some? cell)
(-> (ctl/push-into-cell moving-shapes-ids row column)
(ctl/assign-cells objects)))
(ctl/assign-cell-positions objects)))
{:with-objects? true})
(pcb/reorder-grid-children [frame-id])))
(pcb/remove-objects empty-parents))]