From 0590336c71aacb0dda4530c8b26a180eb352cbd7 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 18 Mar 2024 15:40:46 +0100 Subject: [PATCH] :bug: Fix problem with order of operations --- .../src/app/main/data/workspace/modifiers.cljs | 5 +---- .../src/app/main/data/workspace/transforms.cljs | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/main/data/workspace/modifiers.cljs b/frontend/src/app/main/data/workspace/modifiers.cljs index b552bee67..302f3e6b2 100644 --- a/frontend/src/app/main/data/workspace/modifiers.cljs +++ b/frontend/src/app/main/data/workspace/modifiers.cljs @@ -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))) diff --git a/frontend/src/app/main/data/workspace/transforms.cljs b/frontend/src/app/main/data/workspace/transforms.cljs index c52cd2fbb..10515ac9c 100644 --- a/frontend/src/app/main/data/workspace/transforms.cljs +++ b/frontend/src/app/main/data/workspace/transforms.cljs @@ -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))]