🐛 Fix show measurements shortcut

This commit is contained in:
Eva Marco 2026-07-30 12:47:56 +02:00
parent 15f15538a4
commit 268a77934a
2 changed files with 11 additions and 6 deletions

View File

@ -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!
([]

View File

@ -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"