mirror of
https://github.com/penpot/penpot.git
synced 2025-03-06 04:41:57 -05:00
🐛 Fix problem when creating layouts
This commit is contained in:
parent
8d4b023d61
commit
856e2be1ca
2 changed files with 11 additions and 2 deletions
|
@ -1666,3 +1666,12 @@
|
||||||
(-> cells
|
(-> cells
|
||||||
(d/update-when id d/patch-object (get-data target-cells id))))
|
(d/update-when id d/patch-object (get-data target-cells id))))
|
||||||
source-cells))))))
|
source-cells))))))
|
||||||
|
|
||||||
|
(defn toggle-fix-if-auto
|
||||||
|
"Changes the sizing to fix if it's fill"
|
||||||
|
[shape]
|
||||||
|
(cond-> shape
|
||||||
|
(= (:layout-item-h-sizing shape) :fill)
|
||||||
|
(assoc :layout-item-h-sizing :fix)
|
||||||
|
(= (:layout-item-v-sizing shape) :fill)
|
||||||
|
(assoc :layout-item-v-sizing :fix)))
|
||||||
|
|
|
@ -194,7 +194,7 @@
|
||||||
(cl/remove-all-fills [new-shape-id] {:color clr/black :opacity 1})
|
(cl/remove-all-fills [new-shape-id] {:color clr/black :opacity 1})
|
||||||
(create-layout-from-id new-shape-id type)
|
(create-layout-from-id new-shape-id type)
|
||||||
(dwsh/update-shapes [new-shape-id] #(assoc % :layout-item-h-sizing :auto :layout-item-v-sizing :auto))
|
(dwsh/update-shapes [new-shape-id] #(assoc % :layout-item-h-sizing :auto :layout-item-v-sizing :auto))
|
||||||
(dwsh/update-shapes selected #(assoc % :layout-item-h-sizing :fix :layout-item-v-sizing :fix))
|
(dwsh/update-shapes selected ctl/toggle-fix-if-auto)
|
||||||
(dwsh/delete-shapes page-id selected)
|
(dwsh/delete-shapes page-id selected)
|
||||||
(ptk/data-event :layout/update {:ids [new-shape-id]})
|
(ptk/data-event :layout/update {:ids [new-shape-id]})
|
||||||
(dwu/commit-undo-transaction undo-id)))
|
(dwu/commit-undo-transaction undo-id)))
|
||||||
|
@ -205,7 +205,7 @@
|
||||||
(cl/remove-all-fills [new-shape-id] {:color clr/black :opacity 1})
|
(cl/remove-all-fills [new-shape-id] {:color clr/black :opacity 1})
|
||||||
(create-layout-from-id new-shape-id type)
|
(create-layout-from-id new-shape-id type)
|
||||||
(dwsh/update-shapes [new-shape-id] #(assoc % :layout-item-h-sizing :auto :layout-item-v-sizing :auto))
|
(dwsh/update-shapes [new-shape-id] #(assoc % :layout-item-h-sizing :auto :layout-item-v-sizing :auto))
|
||||||
(dwsh/update-shapes selected #(assoc % :layout-item-h-sizing :fix :layout-item-v-sizing :fix))))
|
(dwsh/update-shapes selected ctl/toggle-fix-if-auto)))
|
||||||
|
|
||||||
(rx/of (ptk/data-event :layout/update {:ids [new-shape-id]})
|
(rx/of (ptk/data-event :layout/update {:ids [new-shape-id]})
|
||||||
(dwu/commit-undo-transaction undo-id))))))))
|
(dwu/commit-undo-transaction undo-id))))))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue