Keyboard shortcut for change shape type (Alt + 1,2,3,4) (#316)

main
Boris Sekachev 7 years ago committed by Nikita Manovich
parent cdc34f6993
commit 19573c81b7

@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- OpenVINO auto annotation: it is possible to upload a custom model and annotate images automatically.
- Ability to rotate images/video in the client part (Ctrl+R, Shift+Ctrl+R shortcuts) (#305)
- The ReID application for automatic bounding box merging has been added (#299)
- Keyboard shortcuts to switch next/previous default shape type (box, polygon etc) [Alt + <, Alt + >] (#316)
### Changed
- Propagation setup has been moved from settings to bottom player panel

@ -965,6 +965,30 @@ class ShapeCollectionController {
}
}.bind(this));
let nextShapeType = Logger.shortkeyLogDecorator(function(e) {
if (window.cvat.mode === null) {
let next = $('#shapeTypeSelector option:selected').next();
if (!next.length) {
next = $('#shapeTypeSelector option').first();
}
next.prop('selected', true);
next.trigger('change');
}
}.bind(this));
let prevShapeType = Logger.shortkeyLogDecorator(function(e) {
if (window.cvat.mode === null) {
let prev = $('#shapeTypeSelector option:selected').prev();
if (!prev.length) {
prev = $('#shapeTypeSelector option').last();
}
prev.prop('selected', true);
prev.trigger('change');
}
}.bind(this));
let shortkeys = window.cvat.config.shortkeys;
Mousetrap.bind(shortkeys["switch_lock_property"].value, switchLockHandler.bind(this), 'keydown');
Mousetrap.bind(shortkeys["switch_all_lock_property"].value, switchAllLockHandler.bind(this), 'keydown');
@ -977,6 +1001,9 @@ class ShapeCollectionController {
Mousetrap.bind(shortkeys["change_shape_label"].value, switchLabelHandler.bind(this), 'keydown');
Mousetrap.bind(shortkeys["delete_shape"].value, removeActiveHandler.bind(this), 'keydown');
Mousetrap.bind(shortkeys["change_shape_color"].value, changeShapeColorHandler.bind(this), 'keydown');
Mousetrap.bind(shortkeys['next_shape_type'].value, nextShapeType.bind(this), 'keydown');
Mousetrap.bind(shortkeys['prev_shape_type'].value, prevShapeType.bind(this), 'keydown');
if (window.cvat.job.z_order) {
Mousetrap.bind(shortkeys["inc_z"].value, incZHandler.bind(this), 'keydown');

@ -299,6 +299,18 @@ class Config {
view_value: 'Ctrl + Shift + R',
description: 'counter clockwise image rotation'
},
next_shape_type: {
value: ['alt+.'],
view_value: 'Alt + >',
description: 'switch next default shape type'
},
prev_shape_type: {
value: ['alt+,'],
view_value: 'Alt + <',
description: 'switch previous default shape type'
},
};
if (window.cvat && window.cvat.job && window.cvat.job.z_order) {

Loading…
Cancel
Save