🐛 Cancel shortcut is not appearing on disabled tab

This commit is contained in:
Eva Marco 2026-07-29 12:33:44 +02:00
parent d5d2bc6eaf
commit 275c93e636
3 changed files with 39 additions and 1 deletions

View File

@ -34,38 +34,46 @@
(def shortcuts
{:escape {:tooltip (ds/esc)
:command ["escape" "enter" "v"]
:section [:workspace]
:fn #(st/emit! (esc-pressed))}
:undo {:tooltip (ds/meta "Z")
:command (ds/c-mod "z")
:section [:workspace]
:fn #(st/emit! dwu/undo)}
:redo {:tooltip (ds/meta "Y")
:command [(ds/c-mod "shift+z") (ds/c-mod "y")]
:section [:workspace]
:fn #(st/emit! dwu/redo)}
;; ZOOM
:increase-zoom {:tooltip "+"
:command "+"
:section [:workspace]
:fn #(st/emit! (dw/increase-zoom nil))}
:decrease-zoom {:tooltip "-"
:command "-"
:section [:workspace]
:fn #(st/emit! (dw/decrease-zoom nil))}
:reset-zoom {:tooltip (ds/shift "0")
:command "shift+0"
:section [:workspace]
:fn #(st/emit! dw/reset-zoom)}
:fit-all {:tooltip (ds/shift "1")
:command "shift+1"
:section [:workspace]
:fn #(st/emit! dw/zoom-to-fit-all)}
:zoom-selected {:tooltip (ds/shift "2")
:command "shift+2"
:section [:workspace]
:fn #(st/emit! dw/zoom-to-selected-shape)}})
(defn get-tooltip [shortcut]
(assert (contains? shortcuts shortcut) (str shortcut))
(get-in shortcuts [shortcut :tooltip]))
(get-in shortcuts [shortcut :tooltip]))

View File

@ -30,120 +30,146 @@
{:move-nodes {:tooltip "M"
:command "m"
:subsections [:path-editor]
:section [:workspace]
:fn #(st/emit! (drp/change-edit-mode :move))}
:draw-nodes {:tooltip "P"
:command "p"
:subsections [:path-editor]
:section [:workspace]
:fn #(st/emit! (drp/change-edit-mode :draw))}
:add-node {:tooltip (ds/shift "+")
:command "shift++"
:subsections [:path-editor]
:section [:workspace]
:fn #(st/emit! (drp/add-node))}
:delete-node {:tooltip (ds/supr)
:command ["del" "backspace"]
:subsections [:path-editor]
:section [:workspace]
:fn #(st/emit! (drp/remove-node))}
:merge-nodes {:tooltip (ds/meta "J")
:command (ds/c-mod "j")
:subsections [:path-editor]
:section [:workspace]
:fn #(st/emit! (drp/merge-nodes))}
:join-nodes {:tooltip "J"
:command "j"
:subsections [:path-editor]
:section [:workspace]
:fn #(st/emit! (drp/join-nodes))}
:separate-nodes {:tooltip "K"
:command "k"
:subsections [:path-editor]
:section [:workspace]
:fn #(st/emit! (drp/separate-nodes))}
:make-corner {:tooltip "X"
:command "x"
:subsections [:path-editor]
:section [:workspace]
:fn #(st/emit! (drp/make-corner))}
:make-curve {:tooltip "C"
:command "c"
:subsections [:path-editor]
:section [:workspace]
:fn #(st/emit! (drp/make-curve))}
:snap-nodes {:tooltip (ds/meta "'")
;;https://github.com/ccampbell/mousetrap/issues/85
:command [(ds/c-mod "'") (ds/c-mod "219")]
:subsections [:path-editor]
:section [:workspace]
:fn #(st/emit! (drp/toggle-snap))}
:escape {:tooltip (ds/esc)
:command ["escape" "enter" "v"]
:section [:workspace]
:fn #(st/emit! (esc-pressed))}
:undo {:tooltip (ds/meta "Z")
:command (ds/c-mod "z")
:section [:workspace]
:fn #(st/emit! (drp/undo-path))}
:redo {:tooltip (ds/meta "Y")
:command [(ds/c-mod "shift+z") (ds/c-mod "y")]
:section [:workspace]
:fn #(st/emit! (drp/redo-path))}
;; ZOOM
:increase-zoom {:tooltip "+"
:command "+"
:section [:workspace]
:fn #(st/emit! (dw/increase-zoom nil))}
:decrease-zoom {:tooltip "-"
:command "-"
:section [:workspace]
:fn #(st/emit! (dw/decrease-zoom nil))}
:reset-zoom {:tooltip (ds/shift "0")
:command "shift+0"
:section [:workspace]
:fn #(st/emit! dw/reset-zoom)}
:fit-all {:tooltip (ds/shift "1")
:command "shift+1"
:section [:workspace]
:fn #(st/emit! dw/zoom-to-fit-all)}
:zoom-selected {:tooltip (ds/shift "2")
:command "shift+2"
:section [:workspace]
:fn #(st/emit! dw/zoom-to-selected-shape)}
;; Arrow movement
:move-fast-up {:tooltip (ds/shift ds/up-arrow)
:command "shift+up"
:section [:workspace]
:fn #(st/emit! (drp/move-selected :up true))}
:move-fast-down {:tooltip (ds/shift ds/down-arrow)
:command "shift+down"
:section [:workspace]
:fn #(st/emit! (drp/move-selected :down true))}
:move-fast-right {:tooltip (ds/shift ds/right-arrow)
:command "shift+right"
:section [:workspace]
:fn #(st/emit! (drp/move-selected :right true))}
:move-fast-left {:tooltip (ds/shift ds/left-arrow)
:command "shift+left"
:section [:workspace]
:fn #(st/emit! (drp/move-selected :left true))}
:move-unit-up {:tooltip ds/up-arrow
:command "up"
:section [:workspace]
:fn #(st/emit! (drp/move-selected :up false))}
:move-unit-down {:tooltip ds/down-arrow
:command "down"
:section [:workspace]
:fn #(st/emit! (drp/move-selected :down false))}
:move-unit-left {:tooltip ds/right-arrow
:command "right"
:section [:workspace]
:fn #(st/emit! (drp/move-selected :right false))}
:move-unit-right {:tooltip ds/left-arrow
:command "left"
:section [:workspace]
:fn #(st/emit! (drp/move-selected :left false))}})
(defn get-tooltip [shortcut]

View File

@ -158,6 +158,7 @@
:escape {:tooltip (ds/esc)
:command "escape"
:subsections [:edit]
:section [:workspace]
:fn #(st/emit! :interrupt (dwdc/clear-drawing) (dw/deselect-all true))}
:find {:tooltip (ds/meta "F") :command (ds/c-mod "f") :subsections [:edit]
@ -184,6 +185,7 @@
:ungroup {:tooltip (ds/shift "G")
:command "shift+g"
:subsections [:modify-layers]
:section [:workspace]
:fn #(emit-when-no-readonly (dw/ungroup-selected))}
:mask {:tooltip (ds/meta "M")
@ -356,11 +358,13 @@
:draw-line {:tooltip "L"
:command "l"
:subsections [:tools]
:section [:workspace]
:fn #(emit-when-no-readonly (dwd/select-for-drawing :line))}
:draw-arrow {:tooltip (ds/shift "L")
:command "shift+l"
:subsections [:tools]
:section [:workspace]
:fn #(emit-when-no-readonly (dwd/select-for-drawing :arrow))}
:draw-curve {:tooltip (ds/shift "C")