mirror of
https://github.com/penpot/penpot.git
synced 2025-05-26 01:06:14 +02:00
🐛 Fix problem moving shapes into grid
This commit is contained in:
parent
c295680c89
commit
02ea0374a3
2 changed files with 10 additions and 8 deletions
|
@ -1294,11 +1294,14 @@
|
||||||
(->> (range start-index (inc to-index))
|
(->> (range start-index (inc to-index))
|
||||||
(map vector shape-ids)
|
(map vector shape-ids)
|
||||||
(reduce (fn [[parent cells] [shape-id idx]]
|
(reduce (fn [[parent cells] [shape-id idx]]
|
||||||
|
;; If the shape to put in a cell is the same that is already in the cell we do nothing
|
||||||
|
(if (= shape-id (get-in parent [:layout-grid-cells (get-in cells [idx :id]) :shapes 0]))
|
||||||
|
[parent cells]
|
||||||
(let [[parent cells] (free-cell-push parent cells idx)]
|
(let [[parent cells] (free-cell-push parent cells idx)]
|
||||||
[(update-in parent [:layout-grid-cells (get-in cells [idx :id])]
|
[(update-in parent [:layout-grid-cells (get-in cells [idx :id])]
|
||||||
assoc :position :manual
|
assoc :position :manual
|
||||||
:shapes [shape-id])
|
:shapes [shape-id])
|
||||||
cells]))
|
cells])))
|
||||||
[parent cells])
|
[parent cells])
|
||||||
(first)))
|
(first)))
|
||||||
parent)))
|
parent)))
|
||||||
|
|
|
@ -585,7 +585,6 @@
|
||||||
:else
|
:else
|
||||||
[move-vector nil])]
|
[move-vector nil])]
|
||||||
|
|
||||||
|
|
||||||
(-> (dwm/create-modif-tree ids (ctm/move-modifiers move-vector))
|
(-> (dwm/create-modif-tree ids (ctm/move-modifiers move-vector))
|
||||||
(dwm/build-change-frame-modifiers objects selected target-frame drop-index cell-data)
|
(dwm/build-change-frame-modifiers objects selected target-frame drop-index cell-data)
|
||||||
(dwm/set-modifiers false false {:snap-ignore-axis snap-ignore-axis}))))))
|
(dwm/set-modifiers false false {:snap-ignore-axis snap-ignore-axis}))))))
|
||||||
|
@ -608,11 +607,11 @@
|
||||||
(->> move-stream
|
(->> move-stream
|
||||||
(rx/last)
|
(rx/last)
|
||||||
(rx/mapcat
|
(rx/mapcat
|
||||||
(fn [[_ target-frame drop-index]]
|
(fn [[_ target-frame drop-index drop-cell]]
|
||||||
(let [undo-id (js/Symbol)]
|
(let [undo-id (js/Symbol)]
|
||||||
(rx/of (dwu/start-undo-transaction undo-id)
|
(rx/of (dwu/start-undo-transaction undo-id)
|
||||||
(dwm/apply-modifiers {:undo-transation? false})
|
(dwm/apply-modifiers {:undo-transation? false})
|
||||||
(move-shapes-to-frame ids target-frame drop-index nil)
|
(move-shapes-to-frame ids target-frame drop-index drop-cell)
|
||||||
(finish-transform)
|
(finish-transform)
|
||||||
(dwu/commit-undo-transaction undo-id))))))))))))))
|
(dwu/commit-undo-transaction undo-id))))))))))))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue