mirror of
https://github.com/penpot/penpot.git
synced 2025-05-13 03:26:38 +02:00
🐛 Unapply token when manually changing layout margin and padding
This commit is contained in:
parent
66eb4fb5ad
commit
9fde4e2121
2 changed files with 22 additions and 8 deletions
|
@ -188,6 +188,8 @@
|
||||||
(cond
|
(cond
|
||||||
(some #{:stroke-color} changed-sub-attr) #{:stroke-color}
|
(some #{:stroke-color} changed-sub-attr) #{:stroke-color}
|
||||||
(some #{:stroke-width} changed-sub-attr) #{:stroke-width})
|
(some #{:stroke-width} changed-sub-attr) #{:stroke-width})
|
||||||
|
(and (= :layout-padding shape-attr) (seq changed-sub-attr)) changed-sub-attr
|
||||||
|
(and (= :layout-item-margin shape-attr) (seq changed-sub-attr)) changed-sub-attr
|
||||||
(border-radius-keys shape-attr) #{shape-attr}
|
(border-radius-keys shape-attr) #{shape-attr}
|
||||||
(sizing-keys shape-attr) #{shape-attr}
|
(sizing-keys shape-attr) #{shape-attr}
|
||||||
(opacity-keys shape-attr) #{shape-attr}
|
(opacity-keys shape-attr) #{shape-attr}
|
||||||
|
|
|
@ -276,9 +276,15 @@
|
||||||
(ptk/reify ::update-layout
|
(ptk/reify ::update-layout
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ _]
|
(watch [_ _ _]
|
||||||
(let [undo-id (js/Symbol)]
|
(let [undo-id (js/Symbol)
|
||||||
|
padding-attrs (-> (get changes :layout-padding)
|
||||||
|
keys
|
||||||
|
set)]
|
||||||
(rx/of (dwu/start-undo-transaction undo-id)
|
(rx/of (dwu/start-undo-transaction undo-id)
|
||||||
(dwsh/update-shapes ids (d/patch-object changes) options)
|
(dwsh/update-shapes ids (d/patch-object changes)
|
||||||
|
(cond-> options
|
||||||
|
(seq padding-attrs)
|
||||||
|
(assoc :changed-sub-attr padding-attrs)))
|
||||||
(ptk/data-event :layout/update {:ids ids})
|
(ptk/data-event :layout/update {:ids ids})
|
||||||
(dwu/commit-undo-transaction undo-id)))))))
|
(dwu/commit-undo-transaction undo-id)))))))
|
||||||
|
|
||||||
|
@ -533,14 +539,20 @@
|
||||||
(ptk/reify ::update-layout-child
|
(ptk/reify ::update-layout-child
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
(let [page-id (or (get options :page-id)
|
(let [page-id (or (get options :page-id)
|
||||||
(get state :current-page-id))
|
(get state :current-page-id))
|
||||||
objects (dsh/lookup-page-objects state page-id)
|
objects (dsh/lookup-page-objects state page-id)
|
||||||
children-ids (->> ids (mapcat #(cfh/get-children-ids objects %)))
|
children-ids (->> ids (mapcat #(cfh/get-children-ids objects %)))
|
||||||
parent-ids (->> ids (map #(cfh/get-parent-id objects %)))
|
parent-ids (->> ids (map #(cfh/get-parent-id objects %)))
|
||||||
undo-id (js/Symbol)]
|
undo-id (js/Symbol)
|
||||||
|
margin-attrs (-> (get changes :layout-item-margin)
|
||||||
|
keys
|
||||||
|
set)]
|
||||||
(rx/of (dwu/start-undo-transaction undo-id)
|
(rx/of (dwu/start-undo-transaction undo-id)
|
||||||
(dwsh/update-shapes ids (d/patch-object changes) options)
|
(dwsh/update-shapes ids (d/patch-object changes)
|
||||||
|
(cond-> options
|
||||||
|
(seq margin-attrs)
|
||||||
|
(assoc :changed-sub-attr margin-attrs)))
|
||||||
(dwsh/update-shapes children-ids (partial fix-child-sizing objects changes) options)
|
(dwsh/update-shapes children-ids (partial fix-child-sizing objects changes) options)
|
||||||
(dwsh/update-shapes
|
(dwsh/update-shapes
|
||||||
parent-ids
|
parent-ids
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue