diff --git a/frontend/src/app/main/ui/workspace/tokens/core.cljs b/frontend/src/app/main/ui/workspace/tokens/core.cljs index cb03a7a27..1bc6e45ca 100644 --- a/frontend/src/app/main/ui/workspace/tokens/core.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/core.cljs @@ -50,7 +50,15 @@ ;; Shape Update Functions ------------------------------------------------------ -(defn update-shape-radius [value shape-ids] +(defn update-shape-radius-single-corner [value shape-ids attribute] + (dch/update-shapes shape-ids + (fn [shape] + (when (ctsr/has-radius? shape) + (ctsr/set-radius-4 shape (first attribute) value))) + {:reg-objects? true + :attrs [:rx :ry :r1 :r2 :r3 :r4]})) + +(defn update-shape-radius-all [value shape-ids] (dch/update-shapes shape-ids (fn [shape] (when (ctsr/has-radius? shape) @@ -203,7 +211,7 @@ [:border-radius {:title "Border Radius" :attributes ctt/border-radius-keys - :on-update-shape update-shape-radius + :on-update-shape update-shape-radius-all :modal {:key :tokens/border-radius :fields [{:label "Border Radius" :key :border-radius}]}}] diff --git a/frontend/test/token_tests/logic/token_actions_test.cljs b/frontend/test/token_tests/logic/token_actions_test.cljs index 3fadf0cdd..585e19d53 100644 --- a/frontend/test/token_tests/logic/token_actions_test.cljs +++ b/frontend/test/token_tests/logic/token_actions_test.cljs @@ -36,11 +36,11 @@ events [(wtc/apply-token {:shape-ids [(:id rect-1)] :attributes #{:rx :ry} :token (toht/get-token file :token-1) - :on-update-shape wtc/update-shape-radius}) + :on-update-shape wtc/update-shape-radius-all}) (wtc/apply-token {:shape-ids [(:id rect-1)] :attributes #{:rx :ry} :token (toht/get-token file :token-2) - :on-update-shape wtc/update-shape-radius})]] + :on-update-shape wtc/update-shape-radius-all})]] (tohs/run-store-async store done events (fn [new-state] @@ -63,7 +63,7 @@ events [(wtc/apply-token {:shape-ids [(:id rect-1)] :attributes #{:rx :ry} :token (toht/get-token file :token-2) - :on-update-shape wtc/update-shape-radius})]] + :on-update-shape wtc/update-shape-radius-all})]] (tohs/run-store-async store done events (fn [new-state] @@ -187,7 +187,7 @@ rect-2 (cths/get-shape file :rect-2) events [(wtc/toggle-token {:shapes [rect-1 rect-2] :token-type-props {:attributes #{:rx :ry} - :on-update-shape wtc/update-shape-radius} + :on-update-shape wtc/update-shape-radius-all} :token (toht/get-token file :token-2)})]] (tohs/run-store-async store done events