mirror of
https://github.com/penpot/penpot.git
synced 2025-03-11 15:21:18 -05:00
🐛 Fix problem when removing margins
This commit is contained in:
parent
785b58a6c4
commit
3db04e1e2b
3 changed files with 17 additions and 6 deletions
|
@ -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)))
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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 []
|
||||
|
|
Loading…
Add table
Reference in a new issue