mirror of
https://github.com/penpot/penpot.git
synced 2025-05-05 07:05:54 +02:00
🐛 Fix problem with grid component propagation
This commit is contained in:
parent
05d6d2fcd4
commit
d2fbb9dfa7
2 changed files with 20 additions and 14 deletions
|
@ -1722,13 +1722,26 @@
|
||||||
(pcb/update-shapes
|
(pcb/update-shapes
|
||||||
[shape-copy-id]
|
[shape-copy-id]
|
||||||
(fn [shape-copy objects]
|
(fn [shape-copy objects]
|
||||||
(let [ids-map
|
(let [component-page
|
||||||
|
(ctf/get-component-page main-container main-component)
|
||||||
|
|
||||||
|
component-swap-children
|
||||||
|
(->> shape-main
|
||||||
|
:shapes
|
||||||
|
(map #(get (:objects component-page) %))
|
||||||
|
(filter #(some? (ctk/get-swap-slot %)))
|
||||||
|
(group-by ctk/get-swap-slot))
|
||||||
|
|
||||||
|
ids-map
|
||||||
(into {}
|
(into {}
|
||||||
(comp
|
(comp
|
||||||
(map #(get objects %))
|
(map #(get objects %))
|
||||||
(keep
|
(keep
|
||||||
(fn [copy-shape]
|
(fn [copy-shape]
|
||||||
(let [main-shape (ctf/get-ref-shape main-container main-component copy-shape)]
|
(let [main-shape
|
||||||
|
(if (some? (ctk/get-swap-slot copy-shape))
|
||||||
|
(first (get component-swap-children (ctk/get-swap-slot copy-shape)))
|
||||||
|
(ctf/get-ref-shape main-container main-component copy-shape))]
|
||||||
[(:id main-shape) (:id copy-shape)]))))
|
[(:id main-shape) (:id copy-shape)]))))
|
||||||
(:shapes shape-copy))
|
(:shapes shape-copy))
|
||||||
|
|
||||||
|
@ -1744,7 +1757,8 @@
|
||||||
main-cells (-> shape-main (ctl/remap-grid-cells ids-map) :layout-grid-cells)]
|
main-cells (-> shape-main (ctl/remap-grid-cells ids-map) :layout-grid-cells)]
|
||||||
(-> shape-copy
|
(-> shape-copy
|
||||||
(assoc :layout-grid-cells
|
(assoc :layout-grid-cells
|
||||||
(ctl/merge-cells copy-cells main-cells omit-touched?)))))
|
(ctl/merge-cells main-cells copy-cells omit-touched?))
|
||||||
|
(ctl/assign-cells objects))))
|
||||||
{:ignore-touched true :with-objects? true})))
|
{:ignore-touched true :with-objects? true})))
|
||||||
|
|
||||||
(defn- update-grid-main-attrs
|
(defn- update-grid-main-attrs
|
||||||
|
|
|
@ -1643,15 +1643,10 @@
|
||||||
untouched as possible"
|
untouched as possible"
|
||||||
[target-cells source-cells omit-touched?]
|
[target-cells source-cells omit-touched?]
|
||||||
(if omit-touched?
|
(if omit-touched?
|
||||||
(letfn [(get-data [cells id]
|
(letfn [(merge-cells [source-cell target-cell]
|
||||||
(dissoc (get cells id) :row :column :row-span :column-span))
|
|
||||||
|
|
||||||
(merge-cells [source-cell target-cell]
|
|
||||||
(-> source-cell
|
(-> source-cell
|
||||||
(d/patch-object
|
(d/patch-object
|
||||||
(dissoc target-cell :shapes :row :column :row-span :column-span))
|
(dissoc target-cell :row :column :row-span :column-span))))]
|
||||||
(cond-> (d/not-empty? (:shapes target-cell))
|
|
||||||
(assoc :shapes (:shapes target-cell)))))]
|
|
||||||
(let [deleted-cells
|
(let [deleted-cells
|
||||||
(into #{}
|
(into #{}
|
||||||
(filter #(not (contains? source-cells %)))
|
(filter #(not (contains? source-cells %)))
|
||||||
|
@ -1659,10 +1654,7 @@
|
||||||
|
|
||||||
touched-cells
|
touched-cells
|
||||||
(into #{}
|
(into #{}
|
||||||
(filter #(and
|
(filter #(not (contains? deleted-cells %)))
|
||||||
(not (contains? deleted-cells %))
|
|
||||||
(not= (get-data source-cells %)
|
|
||||||
(get-data target-cells %))))
|
|
||||||
(keys target-cells))]
|
(keys target-cells))]
|
||||||
|
|
||||||
(->> touched-cells
|
(->> touched-cells
|
||||||
|
|
Loading…
Add table
Reference in a new issue