diff --git a/CHANGELOG.md b/CHANGELOG.md index fd34142351d4..c09777c76c79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ from online detectors & interactors) ( - Authentication with social accounts google & github (, , ) - REST API tests to export job datasets & annotations and validate their structure () - Propagation backward on UI () +- Keyboard shortcut to delete a frame (Alt + Del) () - A PyTorch dataset adapter layer in the SDK () - A way to debug the server deployed with Docker () diff --git a/cvat-ui/src/components/annotation-page/top-bar/player-navigation.tsx b/cvat-ui/src/components/annotation-page/top-bar/player-navigation.tsx index 118f9102c45a..c57dc3856dfb 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/player-navigation.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/player-navigation.tsx @@ -23,6 +23,7 @@ interface Props { frameNumber: number; frameFilename: string; frameDeleted: boolean; + deleteFrameShortcut: string; focusFrameInputShortcut: string; inputFrameRef: React.RefObject; onSliderChange(value: number): void; @@ -41,6 +42,7 @@ function PlayerNavigation(props: Props): JSX.Element { frameNumber, frameFilename, frameDeleted, + deleteFrameShortcut, focusFrameInputShortcut, inputFrameRef, onSliderChange, @@ -104,7 +106,7 @@ function PlayerNavigation(props: Props): JSX.Element { { (!frameDeleted) ? ( - + ) : ( diff --git a/cvat-ui/src/components/annotation-page/top-bar/top-bar.tsx b/cvat-ui/src/components/annotation-page/top-bar/top-bar.tsx index 7a0b71de0234..d238c94adaf9 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/top-bar.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/top-bar.tsx @@ -33,6 +33,7 @@ interface Props { drawShortcut: string; switchToolsBlockerShortcut: string; playPauseShortcut: string; + deleteFrameShortcut: string; nextFrameShortcut: string; previousFrameShortcut: string; forwardShortcut: string; @@ -91,6 +92,7 @@ export default function AnnotationTopBarComponent(props: Props): JSX.Element { drawShortcut, switchToolsBlockerShortcut, playPauseShortcut, + deleteFrameShortcut, nextFrameShortcut, previousFrameShortcut, forwardShortcut, @@ -154,6 +156,7 @@ export default function AnnotationTopBarComponent(props: Props): JSX.Element { { SAVE_JOB: keyMap.SAVE_JOB, UNDO: keyMap.UNDO, REDO: keyMap.REDO, + DELETE_FRAME: keyMap.DELETE_FRAME, NEXT_FRAME: keyMap.NEXT_FRAME, PREV_FRAME: keyMap.PREV_FRAME, FORWARD_FRAME: keyMap.FORWARD_FRAME, @@ -668,6 +669,12 @@ class AnnotationTopBarContainer extends React.PureComponent { this.onSaveAnnotation(); } }, + DELETE_FRAME: (event: KeyboardEvent | undefined) => { + preventDefault(event); + if (canvasIsReady) { + this.onDeleteFrame(); + } + }, NEXT_FRAME: (event: KeyboardEvent | undefined) => { preventDefault(event); if (canvasIsReady) { @@ -760,6 +767,7 @@ class AnnotationTopBarContainer extends React.PureComponent { // this shortcut is handled in interactionHandler.ts separatelly switchToolsBlockerShortcut={normalizedKeyMap.SWITCH_TOOLS_BLOCKER_STATE} playPauseShortcut={normalizedKeyMap.PLAY_PAUSE} + deleteFrameShortcut={normalizedKeyMap.DELETE_FRAME} nextFrameShortcut={normalizedKeyMap.NEXT_FRAME} previousFrameShortcut={normalizedKeyMap.PREV_FRAME} forwardShortcut={normalizedKeyMap.FORWARD_FRAME} diff --git a/cvat-ui/src/reducers/shortcuts-reducer.ts b/cvat-ui/src/reducers/shortcuts-reducer.ts index a1561710d4db..55c4b3ced6a1 100644 --- a/cvat-ui/src/reducers/shortcuts-reducer.ts +++ b/cvat-ui/src/reducers/shortcuts-reducer.ts @@ -258,6 +258,13 @@ const defaultKeyMap = ({ action: 'keydown', applicable: [DimensionType.DIM_2D, DimensionType.DIM_3D], }, + DELETE_FRAME: { + name: 'Delete frame', + description: 'Delete frame', + sequences: ['alt+del'], + action: 'keydown', + applicable: [DimensionType.DIM_2D, DimensionType.DIM_3D], + }, NEXT_FRAME: { name: 'Next frame', description: 'Go to the next frame',