diff --git a/frontend/src/app/main/data/tokens.cljs b/frontend/src/app/main/data/tokens.cljs index 5f6c71e1e3..e0b827518f 100644 --- a/frontend/src/app/main/data/tokens.cljs +++ b/frontend/src/app/main/data/tokens.cljs @@ -6,6 +6,7 @@ (ns app.main.data.tokens (:require + [app.common.data :as d] [app.common.data.macros :as dm] [app.common.files.changes-builder :as pcb] [app.common.geom.point :as gpt] @@ -57,6 +58,9 @@ (->> (map (fn [attr] [attr token-id]) attributes) (into {}))) +(defn unapply-token-id [shape attributes] + (update shape :applied-tokens d/without-keys attributes)) + (defn apply-token-id-to-attributes [{:keys [shape token-id attributes]}] (let [token (token-from-attributes token-id attributes)] (toggle-or-apply-token shape token))) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index 85b3007463..4a26f0f392 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -291,14 +291,14 @@ (on-switch-to-radius-4) (on-switch-to-radius-1)))) - on-border-radius-token-unlink + on-border-radius-token-unapply (mf/use-fn (mf/deps ids change-radius border-radius-tokens) (fn [token] (let [token-value (some-> token wtc/resolve-token-value)] (st/emit! (change-radius (fn [shape] - (-> (update shape :applied-tokens d/without-keys #{:rx :ry :r1 :r2 :r3 :r4}) + (-> (dt/unapply-token-id shape (wtc/token-attributes :border-radius)) (ctsr/set-radius-1 token-value)))))))) on-radius-1-change @@ -498,7 +498,7 @@ [:span {:class (stl/css :icon)} i/corner-radius] [:& editable-select {:placeholder (if (= :multiple (:rx values)) (tr "settings.multiple") "--") - :on-token-remove on-border-radius-token-unlink + :on-token-remove on-border-radius-token-unapply :class (stl/css :token-select) :type "number" :min 0