From 1e9023d40ab06d84ce61f0f823d52eee69e7382f Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 21 Sep 2020 01:44:45 +0300 Subject: [PATCH 1/3] Using alt instead of ctrl to delete a point, fixed reducer --- cvat-canvas/src/typescript/canvasView.ts | 5 ++--- cvat-canvas/src/typescript/svg.patch.ts | 2 +- .../canvas-point-context-menu.tsx | 2 +- cvat-ui/src/reducers/models-reducer.ts | 19 +++++++++++++++---- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/cvat-canvas/src/typescript/canvasView.ts b/cvat-canvas/src/typescript/canvasView.ts index 3cf37f045a85..5c1660f2b5d8 100644 --- a/cvat-canvas/src/typescript/canvasView.ts +++ b/cvat-canvas/src/typescript/canvasView.ts @@ -642,7 +642,7 @@ export class CanvasViewImpl implements CanvasView, Listener { )); if (['polygon', 'polyline', 'points'].includes(state.shapeType)) { - if (e.ctrlKey) { + if (e.altKey) { const { points } = state; self.onEditDone( state, @@ -897,7 +897,6 @@ export class CanvasViewImpl implements CanvasView, Listener { // Setup event handlers this.content.addEventListener('dblclick', (e: MouseEvent): void => { - if (e.ctrlKey || e.shiftKey) return; self.controller.fit(); e.preventDefault(); }); @@ -933,7 +932,7 @@ export class CanvasViewImpl implements CanvasView, Listener { self.controller.drag(e.clientX, e.clientY); if (this.mode !== Mode.IDLE) return; - if (e.ctrlKey || e.shiftKey) return; + if (e.ctrlKey || e.altKey) return; const { offset } = this.controller.geometry; const [x, y] = translateToSVG(this.content, [e.clientX, e.clientY]); diff --git a/cvat-canvas/src/typescript/svg.patch.ts b/cvat-canvas/src/typescript/svg.patch.ts index 3d88c7daed3c..4c33aed9c4ca 100644 --- a/cvat-canvas/src/typescript/svg.patch.ts +++ b/cvat-canvas/src/typescript/svg.patch.ts @@ -175,7 +175,7 @@ SVG.Element.prototype.resize = function constructor(...args: any): any { handler = this.remember('_resizeHandler'); handler.resize = function(e: any) { const { event } = e.detail; - if (event.button === 0 && !event.shiftKey && !event.ctrlKey) { + if (event.button === 0 && !event.shiftKey && !event.altKey) { return handler.constructor.prototype.resize.call(this, e); } } diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/canvas-point-context-menu.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/canvas-point-context-menu.tsx index 9d6f56c05465..82055ea0be00 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/canvas-point-context-menu.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/canvas-point-context-menu.tsx @@ -111,7 +111,7 @@ function CanvasPointContextMenu(props: Props): React.ReactPortal | null { return visible && contextMenuFor && type === ContextMenuType.CANVAS_SHAPE_POINT ? (ReactDOM.createPortal(
- + diff --git a/cvat-ui/src/reducers/models-reducer.ts b/cvat-ui/src/reducers/models-reducer.ts index 18371aea02bd..4dc72ef46436 100644 --- a/cvat-ui/src/reducers/models-reducer.ts +++ b/cvat-ui/src/reducers/models-reducer.ts @@ -66,15 +66,26 @@ export default function ( } case ModelsActionTypes.GET_INFERENCE_STATUS_SUCCESS: { const { inferences } = state; + if (action.payload.activeInference.status === 'finished') { - delete inferences[action.payload.taskID]; - } else { - inferences[action.payload.taskID] = action.payload.activeInference; + return { + ...state, + inferences: Object.fromEntries( + Object.entries(inferences) + .filter(([key]): boolean => +key !== action.payload.taskID), + ), + }; } + const update: any = {}; + update[action.payload.taskID] = action.payload.activeInference; + return { ...state, - inferences: { ...inferences }, + inferences: { + ...state.inferences, + ...update, + }, }; } case ModelsActionTypes.GET_INFERENCE_STATUS_FAILED: { From c0decd031442815dbf0860d90f50579a53ef725b Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 21 Sep 2020 01:46:48 +0300 Subject: [PATCH 2/3] Updated versions --- cvat-canvas/package-lock.json | 2 +- cvat-canvas/package.json | 2 +- cvat-ui/package-lock.json | 2 +- cvat-ui/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cvat-canvas/package-lock.json b/cvat-canvas/package-lock.json index 87e10955d3b7..28464e0056c8 100644 --- a/cvat-canvas/package-lock.json +++ b/cvat-canvas/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-canvas", - "version": "2.1.0", + "version": "2.1.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-canvas/package.json b/cvat-canvas/package.json index ba7f0180f584..4b0d90bbca6e 100644 --- a/cvat-canvas/package.json +++ b/cvat-canvas/package.json @@ -1,6 +1,6 @@ { "name": "cvat-canvas", - "version": "2.1.0", + "version": "2.1.1", "description": "Part of Computer Vision Annotation Tool which presents its canvas library", "main": "src/canvas.ts", "scripts": { diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 3d8430f9ea71..c04acc937476 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.9.5", + "version": "1.9.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 49a483260616..3e03a6776729 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.9.5", + "version": "1.9.6", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { From d7be1ea32d41e354524eb47f0b7c3fbde69f0783 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 21 Sep 2020 01:51:20 +0300 Subject: [PATCH 3/3] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5d159214d27..a24f2f373b9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - UI models (like DEXTR) were redesigned to be more interactive () - Used Ubuntu:20.04 as a base image for CVAT Dockerfile () - Right colors of label tags in label mapping when a user runs automatic detection () +- A key to remove a point from a polyshape [Ctrl => Alt] () ### Deprecated -