mirror of
https://github.com/penpot/penpot.git
synced 2025-05-19 14:46:12 +02:00
🐛 Fix problem when converting an empty frame to layout
This commit is contained in:
parent
94f2681223
commit
664f73b8a5
1 changed files with 7 additions and 5 deletions
|
@ -149,17 +149,19 @@
|
||||||
children-ids (into [] (mapcat #(get-in objects [% :shapes])) ids)
|
children-ids (into [] (mapcat #(get-in objects [% :shapes])) ids)
|
||||||
children-shapes (map (d/getf objects) children-ids)
|
children-shapes (map (d/getf objects) children-ids)
|
||||||
parent (get objects (first ids))
|
parent (get objects (first ids))
|
||||||
flex-params (shapes->flex-params objects children-shapes parent)
|
flex-params (when (d/not-empty? children-shapes)
|
||||||
|
(shapes->flex-params objects children-shapes parent))
|
||||||
undo-id (js/Symbol)]
|
undo-id (js/Symbol)]
|
||||||
(rx/of (dwu/start-undo-transaction undo-id)
|
(rx/of (dwu/start-undo-transaction undo-id)
|
||||||
(dwc/update-shapes ids (get-layout-initializer type from-frame?))
|
(dwc/update-shapes ids (get-layout-initializer type from-frame?))
|
||||||
(dwc/update-shapes
|
(dwc/update-shapes
|
||||||
ids
|
ids
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
(-> shape
|
(cond-> shape
|
||||||
(assoc :layout-item-h-sizing :auto
|
(not from-frame?)
|
||||||
:layout-item-v-sizing :auto)
|
(-> (assoc :layout-item-h-sizing :auto
|
||||||
(merge flex-params))))
|
:layout-item-v-sizing :auto)
|
||||||
|
(merge flex-params)))))
|
||||||
(ptk/data-event :layout/update ids)
|
(ptk/data-event :layout/update ids)
|
||||||
(dwc/update-shapes children-ids #(dissoc % :constraints-h :constraints-v))
|
(dwc/update-shapes children-ids #(dissoc % :constraints-h :constraints-v))
|
||||||
(dwu/commit-undo-transaction undo-id))))))
|
(dwu/commit-undo-transaction undo-id))))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue