diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index 95b71ccd6..ddce143e9 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -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 diff --git a/common/src/app/common/types/token.cljc b/common/src/app/common/types/token.cljc index 12f5c5d3e..f269e2cca 100644 --- a/common/src/app/common/types/token.cljc +++ b/common/src/app/common/types/token.cljc @@ -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}