mirror of
https://github.com/penpot/penpot.git
synced 2025-05-31 14:06:12 +02:00
🐛 Change to patch-object
This commit is contained in:
parent
3db04e1e2b
commit
caee3160f2
3 changed files with 59 additions and 27 deletions
|
@ -369,7 +369,7 @@
|
|||
(watch [_ _ _]
|
||||
(let [undo-id (js/Symbol)]
|
||||
(rx/of (dwu/start-undo-transaction undo-id)
|
||||
(dwc/update-shapes ids #(d/deep-merge % changes))
|
||||
(dwc/update-shapes ids (d/patch-object changes))
|
||||
(ptk/data-event :layout/update ids)
|
||||
(dwu/commit-undo-transaction undo-id))))))
|
||||
|
||||
|
@ -553,14 +553,15 @@
|
|||
parent-ids (->> ids (map #(cph/get-parent-id objects %)))
|
||||
undo-id (js/Symbol)]
|
||||
(rx/of (dwu/start-undo-transaction undo-id)
|
||||
(dwc/update-shapes ids #(d/without-nils-deep (d/deep-merge (or % {}) changes)))
|
||||
(dwc/update-shapes ids (d/patch-object changes))
|
||||
(dwc/update-shapes children-ids (partial fix-child-sizing objects changes))
|
||||
(dwc/update-shapes parent-ids
|
||||
(fn [parent]
|
||||
(-> parent
|
||||
(fix-parent-sizing objects (set ids) changes)
|
||||
(cond-> (ctl/grid-layout? parent)
|
||||
(ctl/assign-cells)))))
|
||||
(dwc/update-shapes
|
||||
parent-ids
|
||||
(fn [parent]
|
||||
(-> parent
|
||||
(fix-parent-sizing objects (set ids) changes)
|
||||
(cond-> (ctl/grid-layout? parent)
|
||||
(ctl/assign-cells)))))
|
||||
(ptk/data-event :layout/update ids)
|
||||
(dwu/commit-undo-transaction undo-id))))))
|
||||
|
||||
|
@ -577,11 +578,13 @@
|
|||
[layout-id]
|
||||
(fn [shape]
|
||||
(->> ids
|
||||
(reduce (fn [shape cell-id]
|
||||
(-> shape
|
||||
(d/update-in-when [:layout-grid-cells cell-id]
|
||||
#(d/without-nils (merge % props)))))
|
||||
shape))))
|
||||
(reduce
|
||||
(fn [shape cell-id]
|
||||
(d/update-in-when
|
||||
shape
|
||||
[:layout-grid-cells cell-id]
|
||||
d/patch-object props))
|
||||
shape))))
|
||||
(ptk/data-event :layout/update [layout-id])
|
||||
(dwu/commit-undo-transaction undo-id))))))
|
||||
|
||||
|
|
|
@ -525,6 +525,7 @@
|
|||
:on-focus #(do
|
||||
(dom/select-target %)
|
||||
(select-paddings true false true false))
|
||||
:nillable true
|
||||
:min 0
|
||||
:value p1}]]
|
||||
[:div {:class (stl/css :padding-simple)
|
||||
|
@ -539,6 +540,7 @@
|
|||
:on-focus #(do (dom/select-target %)
|
||||
(select-paddings false true false true))
|
||||
:on-blur #(select-paddings false false false false)
|
||||
:nillable true
|
||||
:min 0
|
||||
:value p2}]]]
|
||||
(= padding-type :multiple)
|
||||
|
@ -555,6 +557,7 @@
|
|||
:on-focus #(do (dom/select-target %)
|
||||
(select-padding :p1))
|
||||
:on-blur #(select-paddings false false false false)
|
||||
:nillable true
|
||||
:min 0
|
||||
:value (:p1 (:layout-padding values))}]]
|
||||
|
||||
|
@ -569,6 +572,7 @@
|
|||
:on-focus #(do (dom/select-target %)
|
||||
(select-padding :p2))
|
||||
:on-blur #(select-paddings false false false false)
|
||||
:nillable true
|
||||
:min 0
|
||||
:value (:p2 (:layout-padding values))}]]
|
||||
|
||||
|
@ -583,6 +587,7 @@
|
|||
:on-focus #(do (dom/select-target %)
|
||||
(select-padding :p3))
|
||||
:on-blur #(select-paddings false false false false)
|
||||
:nillable true
|
||||
:min 0
|
||||
:value (:p3 (:layout-padding values))}]]
|
||||
|
||||
|
@ -597,6 +602,7 @@
|
|||
:on-focus #(do (dom/select-target %)
|
||||
(select-padding :p4))
|
||||
:on-blur #(select-paddings false false false false)
|
||||
:nillable true
|
||||
:min 0
|
||||
:value (:p4 (:layout-padding values))}]]])]
|
||||
[:button {:class (stl/css-case :padding-toggle true
|
||||
|
@ -618,6 +624,7 @@
|
|||
:on-focus #(do
|
||||
(dom/select-target %)
|
||||
(select-paddings true false true false))
|
||||
:nillable true
|
||||
:min 0
|
||||
:value p1}]]
|
||||
|
||||
|
@ -630,6 +637,7 @@
|
|||
:on-focus #(do (dom/select-target %)
|
||||
(select-paddings false true false true))
|
||||
:on-blur #(select-paddings false false false false)
|
||||
:nillable true
|
||||
:min 0
|
||||
:value p2}]]]
|
||||
|
||||
|
@ -650,6 +658,7 @@
|
|||
:on-focus #(do (dom/select-target %)
|
||||
(select-padding num))
|
||||
:on-blur #(select-paddings false false false false)
|
||||
:nillable true
|
||||
:min 0
|
||||
:value (num (:layout-padding values))}]]])])
|
||||
|
||||
|
@ -691,6 +700,7 @@
|
|||
:on-blur (fn [_]
|
||||
(select-gap nil)
|
||||
(reset! gap-selected? :none))
|
||||
:nillable true
|
||||
:min 0
|
||||
:value (:row-gap gap-value)
|
||||
:disabled (and (= :nowrap wrap-type) (not is-col?))}]]
|
||||
|
@ -710,6 +720,7 @@
|
|||
:on-blur (fn [_]
|
||||
(select-gap nil)
|
||||
(reset! gap-selected? :none))
|
||||
:nillable true
|
||||
:min 0
|
||||
:value (:column-gap gap-value)
|
||||
:disabled (and (= :nowrap wrap-type) is-col?)}]]]
|
||||
|
@ -731,6 +742,7 @@
|
|||
:on-blur (fn [_]
|
||||
(select-gap nil)
|
||||
(reset! gap-selected? :none))
|
||||
:nillable true
|
||||
:min 0
|
||||
:value (:column-gap gap-value)
|
||||
:disabled (and (= :nowrap wrap-type) is-col?)}]]
|
||||
|
@ -749,6 +761,7 @@
|
|||
:on-blur (fn [_]
|
||||
(select-gap nil)
|
||||
(reset! gap-selected? :none))
|
||||
:nillable true
|
||||
:min 0
|
||||
:value (:row-gap gap-value)
|
||||
:disabled (and (= :nowrap wrap-type) (not is-col?))}]]]])))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue