mirror of
https://github.com/penpot/penpot.git
synced 2025-01-22 14:39:45 -05: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))
|
||||
(map vector shape-ids)
|
||||
(reduce (fn [[parent cells] [shape-id idx]]
|
||||
(let [[parent cells] (free-cell-push parent cells idx)]
|
||||
[(update-in parent [:layout-grid-cells (get-in cells [idx :id])]
|
||||
assoc :position :manual
|
||||
:shapes [shape-id])
|
||||
cells]))
|
||||
;; 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)]
|
||||
[(update-in parent [:layout-grid-cells (get-in cells [idx :id])]
|
||||
assoc :position :manual
|
||||
:shapes [shape-id])
|
||||
cells])))
|
||||
[parent cells])
|
||||
(first)))
|
||||
parent)))
|
||||
|
|
|
@ -585,7 +585,6 @@
|
|||
:else
|
||||
[move-vector nil])]
|
||||
|
||||
|
||||
(-> (dwm/create-modif-tree ids (ctm/move-modifiers move-vector))
|
||||
(dwm/build-change-frame-modifiers objects selected target-frame drop-index cell-data)
|
||||
(dwm/set-modifiers false false {:snap-ignore-axis snap-ignore-axis}))))))
|
||||
|
@ -608,11 +607,11 @@
|
|||
(->> move-stream
|
||||
(rx/last)
|
||||
(rx/mapcat
|
||||
(fn [[_ target-frame drop-index]]
|
||||
(fn [[_ target-frame drop-index drop-cell]]
|
||||
(let [undo-id (js/Symbol)]
|
||||
(rx/of (dwu/start-undo-transaction undo-id)
|
||||
(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)
|
||||
(dwu/commit-undo-transaction undo-id))))))))))))))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue