mirror of
https://github.com/penpot/penpot.git
synced 2025-04-13 07:21:40 -05:00
🐛 Fix sync of margin and padding tokens in components
This commit is contained in:
parent
89876ef96f
commit
2c0e18ce1c
2 changed files with 32 additions and 5 deletions
|
@ -1639,7 +1639,21 @@
|
|||
(if (and (empty? roperations) (empty? applied-tokens))
|
||||
changes
|
||||
(let [all-parents (cfh/get-parent-ids (:objects container)
|
||||
(:id dest-shape))]
|
||||
(:id dest-shape))
|
||||
|
||||
;; Sync tokens of attributes ignored above.
|
||||
;; FIXME: this probably may be merged with the other calculation
|
||||
;; of applied tokens, below, and to the calculation only once
|
||||
;; for all sync-attrs.
|
||||
applied-tokens (reduce (fn [applied-tokens attr]
|
||||
(let [attr-group (get ctk/sync-attrs attr)
|
||||
token-attrs (cto/shape-attr->token-attrs attr)]
|
||||
(if (not (and (touched attr-group)
|
||||
omit-touched?))
|
||||
(into applied-tokens token-attrs)
|
||||
applied-tokens)))
|
||||
applied-tokens
|
||||
ctk/swap-keep-attrs)]
|
||||
(cond-> changes
|
||||
(seq roperations)
|
||||
(-> (update :redo-changes conj (make-change
|
||||
|
|
|
@ -182,14 +182,27 @@
|
|||
([shape-attr] (shape-attr->token-attrs shape-attr nil))
|
||||
([shape-attr changed-sub-attr]
|
||||
(cond
|
||||
(= :fills shape-attr) #{:fill}
|
||||
(and (= :strokes shape-attr) (nil? changed-sub-attr)) #{:stroke-width :stroke-color}
|
||||
(= :fills shape-attr)
|
||||
#{:fill}
|
||||
|
||||
(and (= :strokes shape-attr) (nil? changed-sub-attr))
|
||||
#{:stroke-width :stroke-color}
|
||||
|
||||
(= :strokes shape-attr)
|
||||
(cond
|
||||
(some #{:stroke-color} changed-sub-attr) #{:stroke-color}
|
||||
(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
|
||||
|
||||
(= :layout-padding shape-attr)
|
||||
(if (seq changed-sub-attr)
|
||||
changed-sub-attr
|
||||
#{:p1 :p2 :p3 :p4})
|
||||
|
||||
(= :layout-item-margin shape-attr)
|
||||
(if (seq changed-sub-attr)
|
||||
changed-sub-attr
|
||||
#{:m1 :m2 :m3 :m4})
|
||||
|
||||
(border-radius-keys shape-attr) #{shape-attr}
|
||||
(sizing-keys shape-attr) #{shape-attr}
|
||||
(opacity-keys shape-attr) #{shape-attr}
|
||||
|
|
Loading…
Add table
Reference in a new issue