From fcea8f8d30f2e40133f58ceaf768eb01b9c32c4d Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 30 Nov 2020 16:30:03 +0300 Subject: [PATCH 1/2] Fixed grouping when press escape with drawn region or change a frame --- cvat-canvas/src/typescript/groupHandler.ts | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/cvat-canvas/src/typescript/groupHandler.ts b/cvat-canvas/src/typescript/groupHandler.ts index 84f840cf66c7..c94b5cbf150f 100644 --- a/cvat-canvas/src/typescript/groupHandler.ts +++ b/cvat-canvas/src/typescript/groupHandler.ts @@ -35,11 +35,11 @@ export class GroupHandlerImpl implements GroupHandler { private getSelectionBox( event: MouseEvent, ): { - xtl: number; - ytl: number; - xbr: number; - ybr: number; - } { + xtl: number; + ytl: number; + xbr: number; + ybr: number; + } { const point = translateToSVG((this.canvas.node as any) as SVGSVGElement, [event.clientX, event.clientY]); const stopSelectionPoint = { x: point[0], @@ -96,11 +96,11 @@ export class GroupHandlerImpl implements GroupHandler { const bbox = shape.bbox(); const clientID = shape.attr('clientID'); if ( - bbox.x > box.xtl && - bbox.y > box.ytl && - bbox.x + bbox.width < box.xbr && - bbox.y + bbox.height < box.ybr && - !(clientID in this.highlightedShapes) + bbox.x > box.xtl + && bbox.y > box.ytl + && bbox.x + bbox.width < box.xbr + && bbox.y + bbox.height < box.ybr + && !(clientID in this.highlightedShapes) ) { const objectState = this.getStates().filter( (state: any): boolean => state.clientID === clientID, @@ -124,7 +124,6 @@ export class GroupHandlerImpl implements GroupHandler { this.resetSelectedObjects(); this.initialized = false; - this.selectionRect = null; this.startSelectionPoint = { x: null, y: null, @@ -213,6 +212,10 @@ export class GroupHandlerImpl implements GroupHandler { } this.statesToBeGroupped = []; this.highlightedShapes = {}; + if (this.selectionRect) { + this.selectionRect.remove(); + this.selectionRect = null; + } } public cancel(): void { From b0a945ce4e92b4080b24c6217893f34a6eedc8b0 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Mon, 30 Nov 2020 16:33:16 +0300 Subject: [PATCH 2/2] Updated version & changelog --- CHANGELOG.md | 1 + cvat-canvas/package-lock.json | 2 +- cvat-canvas/package.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d91159ab0d24..97a6401ce32f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Projects view layout fix () - Fixed the tasks view (infinite loading) when it is impossible to get a preview of the task () - Empty frames navigation () +- Extra shapes are drawn after Esc, or G pressed while drawing a region in grouping () ### Security diff --git a/cvat-canvas/package-lock.json b/cvat-canvas/package-lock.json index 8fed7d27d097..f56da2997b2a 100644 --- a/cvat-canvas/package-lock.json +++ b/cvat-canvas/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-canvas", - "version": "2.1.3", + "version": "2.1.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-canvas/package.json b/cvat-canvas/package.json index d509f493c369..dd7b4fcdc642 100644 --- a/cvat-canvas/package.json +++ b/cvat-canvas/package.json @@ -1,6 +1,6 @@ { "name": "cvat-canvas", - "version": "2.1.3", + "version": "2.1.4", "description": "Part of Computer Vision Annotation Tool which presents its canvas library", "main": "src/canvas.ts", "scripts": {