mirror of
https://github.com/penpot/penpot.git
synced 2025-02-22 23:06:08 -05:00
🐛 Fix problem with grid layout duplicate positioning (#5877)
This commit is contained in:
parent
3412a0a18a
commit
0900b7a572
2 changed files with 8 additions and 8 deletions
|
@ -12,7 +12,6 @@
|
|||
[app.common.files.helpers :as cfh]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.geom.shapes.grid-layout :as gslg]
|
||||
[app.common.logging :as log]
|
||||
[app.common.logic.shapes :as cls]
|
||||
[app.common.spec :as us]
|
||||
|
@ -226,18 +225,19 @@
|
|||
changes
|
||||
(if (ctl/grid-layout? objects (:parent-id first-shape))
|
||||
(let [target-cell (-> position meta :cell)
|
||||
|
||||
[row column]
|
||||
(if (some? target-cell)
|
||||
[(:row target-cell) (:column target-cell)]
|
||||
(gslg/get-drop-cell (:parent-id first-shape) objects position))]
|
||||
(when (some? target-cell)
|
||||
[(:row target-cell) (:column target-cell)])]
|
||||
(-> changes
|
||||
(pcb/update-shapes
|
||||
[(:parent-id first-shape)]
|
||||
(fn [shape objects]
|
||||
(-> shape
|
||||
(ctl/assign-cells objects)
|
||||
(ctl/push-into-cell [(:id first-shape)] row column)
|
||||
(ctl/assign-cells objects)))
|
||||
(cond-> (and (some? row) (some? column))
|
||||
(-> (ctl/push-into-cell [(:id first-shape)] row column)
|
||||
(ctl/assign-cells objects)))))
|
||||
{:with-objects? true})
|
||||
(pcb/reorder-grid-children [(:parent-id first-shape)])))
|
||||
changes)
|
||||
|
|
|
@ -1307,9 +1307,9 @@
|
|||
"Push the shapes into the row/column cell and moves the rest"
|
||||
[parent shape-ids row column]
|
||||
|
||||
(let [cells (vec (get-cells parent {:sort? true}))
|
||||
(let [parent (-> parent (free-cell-shapes shape-ids))
|
||||
cells (vec (get-cells parent {:sort? true}))
|
||||
[start-index start-cell] (seek-indexed-cell cells row column)]
|
||||
|
||||
(if (some? start-cell)
|
||||
(let [;; start-index => to-index is the range where the shapes inserted will be added
|
||||
to-index (min (+ start-index (count shape-ids)) (dec (count cells)))]
|
||||
|
|
Loading…
Add table
Reference in a new issue