@fabwcie/free-drawing / utils/HotKey
utils/HotKey
Classes
HotKey
Defined in: packages/free-drawing/src/utils/HotKey.ts:85
Keyboard shortcuts of drawer, listened on its container: tools, selection (move, delete, duplicate, group, order, flip, rotate), history, files, panels. Nothing runs during a pointer action, shortcuts modifying the drawing do nothing in read only.
Constructors
Constructor
new HotKey(
drawer):HotKey
Defined in: packages/free-drawing/src/utils/HotKey.ts:93
Listens to shortcuts on keydown of the drawer container
Parameters
drawer
drawer whose shortcuts are handled
Returns
Properties
drawer
drawer:
Drawer
Defined in: packages/free-drawing/src/utils/HotKey.ts:87
Drawer whose shortcuts are handled
Functions
keyLetter()
keyLetter(
e):string
Defined in: packages/free-drawing/src/utils/HotKey.ts:50
Letter of a key event, in lowercase (whatever Shift or Caps Lock): the letter typed, else with Option of macOS (changing it) the letter of its physical key on the keyboard layout (read in Chromium or typed before), else (keyboard of another alphabet) the letter at its place on a QWERTY keyboard, as Ctrl shortcuts of systems. Not with AltGr (Ctrl + Alt), which types other characters
Parameters
e
KeyboardEvent
Key pressed
Returns
string
Letter, or value of another key in lowercase (delete, ,, f2...)
matchesShortcut()
matchesShortcut(
e,shortcut):boolean
Defined in: packages/free-drawing/src/utils/HotKey.ts:67
Key event of a shortcut: Ctrl (also Cmd), Shift and Alt exactly as given, then the key: a digit by its place (Shift changes it), a letter by keyLetter (Alt and Caps Lock change characters), else by its value (Delete, F2...)
Parameters
e
KeyboardEvent
Key pressed
shortcut
string
Keys separated by +, e.g. Ctrl+Shift+M, Alt+P, Delete
Returns
boolean
true when the event is the shortcut