From 268a77934a49402c29545d81f2b5f6fde68c15fc Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Thu, 30 Jul 2026 12:47:56 +0200 Subject: [PATCH] :bug: Fix show measurements shortcut --- frontend/src/app/main/data/shortcuts.cljs | 11 +++++++---- frontend/src/app/main/data/workspace/shortcuts.cljs | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/main/data/shortcuts.cljs b/frontend/src/app/main/data/shortcuts.cljs index 8325370e45..84595c2b7f 100644 --- a/frontend/src/app/main/data/shortcuts.cljs +++ b/frontend/src/app/main/data/shortcuts.cljs @@ -207,13 +207,16 @@ (remove #(:disabled (second %))) (run! (fn [[key {:keys [command fn type overwrite]}]] (let [callback (wrap-cb key fn) - undefined (js* "(void 0)") commands (if (vector? command) (into-array command) #js [command])] - (if type - (mousetrap/bind commands callback type overwrite) - (mousetrap/bind commands callback undefined overwrite))))))) + (if (vector? type) + (do (mousetrap/bind commands callback (nth type 0) overwrite) + (mousetrap/bind commands callback (nth type 1) overwrite)) + (let [undefined (js* "(void 0)")] + (if type + (mousetrap/bind commands callback type overwrite) + (mousetrap/bind commands callback undefined overwrite))))))))) (defn- reset! ([] diff --git a/frontend/src/app/main/data/workspace/shortcuts.cljs b/frontend/src/app/main/data/workspace/shortcuts.cljs index c548bcd184..192258f0d7 100644 --- a/frontend/src/app/main/data/workspace/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/shortcuts.cljs @@ -150,10 +150,12 @@ :show-measure {:tooltip (ds/alt "") :command ["alt" "."] - :type "keydown" + :type ["keydown" "keyup"] :subsections [:tools] :section [:workspace] - :fn #(emit-when-no-readonly (dw/toggle-distances-display true))} + :fn #(emit-when-no-readonly + (let [type (.-type %)] + (dw/toggle-distances-display (if (= type "keydown") true false))))} :escape {:tooltip (ds/esc) :command "escape"