Keyboard Shortcuts
osdlabel is designed for high-throughput annotation tasks with a comprehensive set of keyboard shortcuts.
Default shortcuts
Section titled “Default shortcuts”| Key | Action |
|---|---|
v | Select tool |
r | Rectangle tool |
c | Circle tool |
l | Line tool |
p | Point tool |
d | Polyline (draw) tool |
f | Free hand path tool |
Escape | Deselect annotation, then deactivate tool |
Delete / Backspace | Delete selected annotation |
1–9 | Activate grid cell by position |
= / + | Add a grid column |
- | Remove a grid column |
] | Add a grid row |
[ | Remove a grid row |
Polyline tool shortcuts
Section titled “Polyline tool shortcuts”| Key | Action |
|---|---|
Enter | Finish as open polyline |
c | Close as polygon |
Escape | Cancel polyline in progress |
Free hand path tool shortcuts
Section titled “Free hand path tool shortcuts”| Key | Action |
|---|---|
Shift | Hold while drawing to produce an open polyline |
Escape | Cancel stroke in progress |
Customizing shortcuts
Section titled “Customizing shortcuts”Pass a keyboardShortcuts prop to override any default binding:
<AnnotatorProvider keyboardShortcuts={{ rectangleTool: 'b', // 'b' for box instead of 'r' circleTool: 'o', // 'o' for oval instead of 'c' delete: 'x', // 'x' to delete instead of Delete }}> {/* ... */}</AnnotatorProvider>Or via the Annotator component:
<Annotator images={images} contexts={contexts} keyboardShortcuts={{ rectangleTool: 'b' }} />Unspecified keys keep their default bindings. See KeyboardShortcutMap for all available keys.
Suppressing shortcuts
Section titled “Suppressing shortcuts”Shortcuts are automatically suppressed when focus is in an <input>, <textarea>, or contenteditable element.
For additional suppression logic, use the shouldSkipKeyboardShortcutPredicate prop:
<AnnotatorProvider shouldSkipKeyboardShortcutPredicate={(target) => { // Skip shortcuts when focus is inside a modal return target.closest('.modal') !== null; }}> {/* ... */}</AnnotatorProvider>