0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-11 23:31:21 -05:00

🐛 Fix problem when removing margins

This commit is contained in:
alonso.torres 2023-10-05 16:44:03 +02:00
parent 785b58a6c4
commit 3db04e1e2b
3 changed files with 17 additions and 6 deletions

View file

@ -223,6 +223,20 @@
([data]
(into {} (without-nils) data)))
(defn without-nils-deep
"Given a map remove the `nil` values and when a child map is found
recursively removes them as well."
[data]
(let [data (without-nils
(c/update-vals
data
(fn [value]
(cond-> value
(map? value)
(without-nils-deep)))))]
(when (not-empty? data)
data)))
(defn without-qualified
([]
(remove (comp qualified-keyword? key)))

View file

@ -553,7 +553,7 @@
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/deep-merge (or % {}) changes))
(dwc/update-shapes ids #(d/without-nils-deep (d/deep-merge (or % {}) changes)))
(dwc/update-shapes children-ids (partial fix-child-sizing objects changes))
(dwc/update-shapes parent-ids
(fn [parent]

View file

@ -45,21 +45,18 @@
m1 (when (and (not (= :multiple (:layout-item-margin values)))
(= (dm/get-in values [:layout-item-margin :m1])
(dm/get-in values [:layout-item-margin :m3])))
(dm/get-in values [:layout-item-margin :m1])
)
(dm/get-in values [:layout-item-margin :m1]))
m2 (when (and (not (= :multiple (:layout-item-margin values)))
(= (dm/get-in values [:layout-item-margin :m2])
(dm/get-in values [:layout-item-margin :m4])))
(dm/get-in values [:layout-item-margin :m2])
)
(dm/get-in values [:layout-item-margin :m2]))
select-margins
(fn [m1? m2? m3? m4?]
(st/emit! (udw/set-margins-selected {:m1 m1? :m2 m2? :m3 m3? :m4 m4?})))
select-margin #(select-margins (= % :m1) (= % :m2) (= % :m3) (= % :m4))]
(mf/use-effect
(fn []
(fn []