mirror of
https://github.com/penpot/penpot.git
synced 2025-06-08 00:51:37 +02: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]
|
([data]
|
||||||
(into {} (without-nils) 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
|
(defn without-qualified
|
||||||
([]
|
([]
|
||||||
(remove (comp qualified-keyword? key)))
|
(remove (comp qualified-keyword? key)))
|
||||||
|
|
|
@ -553,7 +553,7 @@
|
||||||
parent-ids (->> ids (map #(cph/get-parent-id objects %)))
|
parent-ids (->> ids (map #(cph/get-parent-id objects %)))
|
||||||
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 #(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 children-ids (partial fix-child-sizing objects changes))
|
||||||
(dwc/update-shapes parent-ids
|
(dwc/update-shapes parent-ids
|
||||||
(fn [parent]
|
(fn [parent]
|
||||||
|
|
|
@ -45,21 +45,18 @@
|
||||||
m1 (when (and (not (= :multiple (:layout-item-margin values)))
|
m1 (when (and (not (= :multiple (:layout-item-margin values)))
|
||||||
(= (dm/get-in values [:layout-item-margin :m1])
|
(= (dm/get-in values [:layout-item-margin :m1])
|
||||||
(dm/get-in values [:layout-item-margin :m3])))
|
(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)))
|
m2 (when (and (not (= :multiple (:layout-item-margin values)))
|
||||||
(= (dm/get-in values [:layout-item-margin :m2])
|
(= (dm/get-in values [:layout-item-margin :m2])
|
||||||
(dm/get-in values [:layout-item-margin :m4])))
|
(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
|
select-margins
|
||||||
(fn [m1? m2? m3? m4?]
|
(fn [m1? m2? m3? m4?]
|
||||||
(st/emit! (udw/set-margins-selected {:m1 m1? :m2 m2? :m3 m3? :m4 m4?})))
|
(st/emit! (udw/set-margins-selected {:m1 m1? :m2 m2? :m3 m3? :m4 m4?})))
|
||||||
|
|
||||||
select-margin #(select-margins (= % :m1) (= % :m2) (= % :m3) (= % :m4))]
|
select-margin #(select-margins (= % :m1) (= % :m2) (= % :m3) (= % :m4))]
|
||||||
|
|
||||||
|
|
||||||
(mf/use-effect
|
(mf/use-effect
|
||||||
(fn []
|
(fn []
|
||||||
(fn []
|
(fn []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue