From e5d764881f203313e285b73ee5ddea8071eda225 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 21 Apr 2020 23:36:39 +0300 Subject: [PATCH 01/11] Fixed hidden property #1433 --- cvat-core/src/annotations-objects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cvat-core/src/annotations-objects.js b/cvat-core/src/annotations-objects.js index 9620d2c4b554..a6192dc03a7d 100644 --- a/cvat-core/src/annotations-objects.js +++ b/cvat-core/src/annotations-objects.js @@ -371,7 +371,7 @@ updateTimestamp(updated) { const anyChanges = updated.label || updated.attributes || updated.points || updated.outside || updated.occluded || updated.keyframe - || updated.zOrder; + || updated.zOrder || updated.hidden || updated.lock || updated.pinned; if (anyChanges) { this.updated = Date.now(); From 22fea199319d8cfdb48aed11498a9edbe1a31128 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 21 Apr 2020 23:40:29 +0300 Subject: [PATCH 02/11] Fixed highlighted attribute in AAM #1425 --- cvat-canvas/src/typescript/canvasModel.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cvat-canvas/src/typescript/canvasModel.ts b/cvat-canvas/src/typescript/canvasModel.ts index f7f095ea3501..d07526c91bdf 100644 --- a/cvat-canvas/src/typescript/canvasModel.ts +++ b/cvat-canvas/src/typescript/canvasModel.ts @@ -368,7 +368,9 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel { } public activate(clientID: number | null, attributeID: number | null): void { - if (this.data.activeElement.clientID === clientID) { + if (this.data.activeElement.clientID === clientID + && this.data.activeElement.attributeID === attributeID + ) { return; } From c41ff0618491f8b987c07d4c53c56d8480a602ba Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 22 Apr 2020 00:13:15 +0300 Subject: [PATCH 03/11] Tuned shaking while drawing a polygon #1413 --- cvat-canvas/src/typescript/canvasView.ts | 4 +- cvat-canvas/src/typescript/drawHandler.ts | 54 +++++------------------ cvat-canvas/src/typescript/editHandler.ts | 22 +-------- 3 files changed, 15 insertions(+), 65 deletions(-) diff --git a/cvat-canvas/src/typescript/canvasView.ts b/cvat-canvas/src/typescript/canvasView.ts index 801dde519b50..a5260f31f5b2 100644 --- a/cvat-canvas/src/typescript/canvasView.ts +++ b/cvat-canvas/src/typescript/canvasView.ts @@ -673,7 +673,9 @@ export class CanvasViewImpl implements CanvasView, Listener { this.content.addEventListener('mousedown', (event): void => { if ([1, 2].includes(event.which)) { - if (![Mode.ZOOM_CANVAS, Mode.GROUP].includes(this.mode) || event.which === 2) { + if ([Mode.IDLE, Mode.DRAG, Mode.MERGE, Mode.SPLIT].includes(this.mode) + || event.which === 2 || event.altKey + ) { self.controller.enableDrag(event.clientX, event.clientY); } } diff --git a/cvat-canvas/src/typescript/drawHandler.ts b/cvat-canvas/src/typescript/drawHandler.ts index 5878c8847cf6..c97d82551955 100644 --- a/cvat-canvas/src/typescript/drawHandler.ts +++ b/cvat-canvas/src/typescript/drawHandler.ts @@ -3,12 +3,10 @@ // SPDX-License-Identifier: MIT import * as SVG from 'svg.js'; -import consts from './consts'; import 'svg.draw.js'; import './svg.patch'; import { AutoborderHandler } from './autoborderHandler'; - import { translateToSVG, displayShapeSize, @@ -18,7 +16,7 @@ import { BBox, Box, } from './shared'; - +import consts from './consts'; import { DrawData, Geometry, @@ -136,7 +134,6 @@ export class DrawHandlerImpl implements DrawHandler { this.autoborderHandler.autoborder(false); this.initialized = false; this.canvas.off('mousedown.draw'); - this.canvas.off('mouseup.draw'); this.canvas.off('mousemove.draw'); this.canvas.off('click.draw'); @@ -256,7 +253,7 @@ export class DrawHandlerImpl implements DrawHandler { // Add ability to cancel the latest drawn point this.canvas.on('mousedown.draw', (e: MouseEvent): void => { - if (e.which === 3) { + if (e.button === 2) { e.stopPropagation(); e.preventDefault(); this.drawInstance.draw('undo'); @@ -502,54 +499,23 @@ export class DrawHandlerImpl implements DrawHandler { } private setupPasteEvents(): void { - let mouseX: number | null = null; - let mouseY: number | null = null; - this.canvas.on('mousedown.draw', (e: MouseEvent): void => { - if (e.which === 1) { - mouseX = e.clientX; - mouseY = e.clientY; - } - }); - - this.canvas.on('mouseup.draw', (e: MouseEvent): void => { - const threshold = 10; // px - if (e.which === 1) { - if (Math.sqrt( // l2 distance < threshold - ((mouseX - e.clientX) ** 2) - + ((mouseY - e.clientY) ** 2), - ) < threshold) { - this.drawInstance.fire('done', { originalEvent: e }); - } + if (e.button === 0 && !e.altKey) { + this.drawInstance.fire('done', { originalEvent: e }); } }); } private setupDrawEvents(): void { let initialized = false; - let mouseX: number | null = null; - let mouseY: number | null = null; this.canvas.on('mousedown.draw', (e: MouseEvent): void => { - if (e.which === 1) { - mouseX = e.clientX; - mouseY = e.clientY; - } - }); - - this.canvas.on('mouseup.draw', (e: MouseEvent): void => { - const threshold = 10; // px - if (e.which === 1) { - if (Math.sqrt( // l2 distance < threshold - ((mouseX - e.clientX) ** 2) - + ((mouseY - e.clientY) ** 2), - ) < threshold) { - if (!initialized) { - this.drawInstance.draw(e, { snapToGrid: 0.1 }); - initialized = true; - } else { - this.drawInstance.draw(e); - } + if (e.button === 0 && !e.altKey) { + if (!initialized) { + this.drawInstance.draw(e, { snapToGrid: 0.1 }); + initialized = true; + } else { + this.drawInstance.draw(e); } } }); diff --git a/cvat-canvas/src/typescript/editHandler.ts b/cvat-canvas/src/typescript/editHandler.ts index 41d03edcc028..74446096b542 100644 --- a/cvat-canvas/src/typescript/editHandler.ts +++ b/cvat-canvas/src/typescript/editHandler.ts @@ -95,13 +95,9 @@ export class EditHandlerImpl implements EditHandler { } private setupEditEvents(): void { - let mouseX: number | null = null; - let mouseY: number | null = null; - this.canvas.on('mousedown.edit', (e: MouseEvent): void => { - if (e.button === 0) { - mouseX = e.clientX; - mouseY = e.clientY; + if (e.button === 0 && !e.altKey) { + (this.editLine as any).draw('point', e); } else if (e.button === 2 && this.editLine) { if (this.editData.state.shapeType === 'points' || this.editLine.attr('points').split(' ').length > 2 @@ -110,18 +106,6 @@ export class EditHandlerImpl implements EditHandler { } } }); - - this.canvas.on('mouseup.edit', (e: MouseEvent): void => { - const threshold = 10; // px - if (e.button === 0) { - if (Math.sqrt( // l2 distance < threshold - ((mouseX - e.clientX) ** 2) - + ((mouseY - e.clientY) ** 2), - ) < threshold) { - (this.editLine as any).draw('point', e); - } - } - }); } private selectPolygon(shape: SVG.Polygon): void { @@ -192,7 +176,6 @@ export class EditHandlerImpl implements EditHandler { // We do not need these events any more this.canvas.off('mousedown.edit'); - this.canvas.off('mouseup.edit'); this.canvas.off('mousemove.edit'); (this.editLine as any).draw('stop'); @@ -274,7 +257,6 @@ export class EditHandlerImpl implements EditHandler { private release(): void { this.canvas.off('mousedown.edit'); - this.canvas.off('mouseup.edit'); this.canvas.off('mousemove.edit'); this.autoborderHandler.autoborder(false); From 7c5783a75862a14c400b4182a60848ec1d395b00 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 22 Apr 2020 00:49:46 +0300 Subject: [PATCH 04/11] Fixed filter #1444 --- cvat-core/src/annotations-filter.js | 4 ++-- .../components/annotation-page/annotations-filters-input.tsx | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cvat-core/src/annotations-filter.js b/cvat-core/src/annotations-filter.js index 8a00cab28c09..6fc0b377aa19 100644 --- a/cvat-core/src/annotations-filter.js +++ b/cvat-core/src/annotations-filter.js @@ -18,7 +18,7 @@ const { ArgumentError } = require('./exceptions'); class AnnotationsFilter { constructor() { // eslint-disable-next-line security/detect-unsafe-regex - this.operatorRegex = /(==|!=|<=|>=|>|<|~=)(?=(?:[^"]*(["])[^"]*\2)*[^"]*$)/g; + this.operatorRegex = /(==|!=|<=|>=|>|<)(?=(?:[^"]*(["])[^"]*\2)*[^"]*$)/g; } // Method splits expression by operators that are outside of any brackets @@ -204,7 +204,7 @@ class AnnotationsFilter { serverID: state.serverID, clientID: state.clientID, type: state.objectType, - shape: state.objectShape, + shape: state.shapeType, occluded: state.occluded, }; }); diff --git a/cvat-ui/src/components/annotation-page/annotations-filters-input.tsx b/cvat-ui/src/components/annotation-page/annotations-filters-input.tsx index b6e98198a035..f2ddbac945b3 100644 --- a/cvat-ui/src/components/annotation-page/annotations-filters-input.tsx +++ b/cvat-ui/src/components/annotation-page/annotations-filters-input.tsx @@ -93,7 +93,7 @@ function filtersHelpModalContent( width, height, label, serverID, clientID, type, shape, occluded
Supported operators: - ==, !=, >, >=, <, <=, ~=, (), & and | + ==, !=, >, >=, <, <=, (), & and |
If you have double quotes in your query string, @@ -107,6 +107,7 @@ function filtersHelpModalContent( Examples
  • label=="car" | label==["road sign"]
  • +
  • shape == "polygon"
  • width >= height
  • attr["Attribute 1"] == attr["Attribute 2"]
  • clientID == 50
  • From 4ba465de63a4a5482925069f05c587d52195ee35 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 22 Apr 2020 00:56:44 +0300 Subject: [PATCH 05/11] Fixed remaimed block information after deactivating a locked object #1439 --- cvat-canvas/src/typescript/canvasView.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cvat-canvas/src/typescript/canvasView.ts b/cvat-canvas/src/typescript/canvasView.ts index a5260f31f5b2..43ff1c99e60b 100644 --- a/cvat-canvas/src/typescript/canvasView.ts +++ b/cvat-canvas/src/typescript/canvasView.ts @@ -1381,11 +1381,6 @@ export class CanvasViewImpl implements CanvasView, Listener { } }); - this.activeElement = { - ...this.activeElement, - clientID, - }; - this.canvas.dispatchEvent(new CustomEvent('canvas.activated', { bubbles: false, cancelable: true, @@ -1409,6 +1404,10 @@ export class CanvasViewImpl implements CanvasView, Listener { const { clientID, attributeID } = activeElement; if (clientID !== null && this.activeElement.clientID !== clientID) { this.activateShape(clientID); + this.activeElement = { + ...this.activeElement, + clientID, + }; } if (clientID !== null From 1ae3e6abe98cccca808caeaaa22d7d733a614f37 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 22 Apr 2020 01:00:29 +0300 Subject: [PATCH 06/11] Fixed uploading annotations #1439 --- cvat-ui/src/actions/annotation-actions.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cvat-ui/src/actions/annotation-actions.ts b/cvat-ui/src/actions/annotation-actions.ts index 8f24bb65ac2f..19e9649d388f 100644 --- a/cvat-ui/src/actions/annotation-actions.ts +++ b/cvat-ui/src/actions/annotation-actions.ts @@ -362,6 +362,10 @@ ThunkAction, {}, {}, AnyAction> { }, ); + await job.annotations.clear(true); + await job.actions.clear(); + const history = await job.actions.get(); + // One more update to escape some problems // in canvas when shape with the same // clientID has different type (polygon, rectangle) for example @@ -370,12 +374,10 @@ ThunkAction, {}, {}, AnyAction> { payload: { job, states: [], + history, }, }); - await job.annotations.clear(true); - await job.actions.clear(); - const history = await job.actions.get(); const states = await job.annotations.get(frame, showAllInterpolationTracks, filters); setTimeout(() => { From 442b82694432ac2b4ee491fc86651ac2ff93a199 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 22 Apr 2020 01:11:35 +0300 Subject: [PATCH 07/11] Updated changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e297fc1feb3b..9b531eab7eb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Auto annotation, TF annotation and Auto segmentation apps (https://github.com/opencv/cvat/pull/1409) - Import works with truncated images now: "OSError:broken data stream" on corrupt images (https://github.com/opencv/cvat/pull/1430) +- Hide functionality (H) doesn't work #1433 +- The highlighted attribute doesn't correspond to the chosen attribute in AAM #1433 +- Inconvinient image shaking while drawing a polygon (hold Alt key during drawing/editing/grouping to drag an image) #1433 +- Filter property "shape" doesn't work and extra operator in description #1433 +- Block of text information doesn't disappear after deactivating for locked shapes #1433 +- Annotation uploading fails in annotation view #1433 ### Security - From ee46c10978817861d15060e57cd8cb4e5f31cc9b Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 22 Apr 2020 01:14:41 +0300 Subject: [PATCH 08/11] Fixed links --- CHANGELOG.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b531eab7eb2..86ff169733ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,12 +21,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Auto annotation, TF annotation and Auto segmentation apps (https://github.com/opencv/cvat/pull/1409) - Import works with truncated images now: "OSError:broken data stream" on corrupt images (https://github.com/opencv/cvat/pull/1430) -- Hide functionality (H) doesn't work #1433 -- The highlighted attribute doesn't correspond to the chosen attribute in AAM #1433 -- Inconvinient image shaking while drawing a polygon (hold Alt key during drawing/editing/grouping to drag an image) #1433 -- Filter property "shape" doesn't work and extra operator in description #1433 -- Block of text information doesn't disappear after deactivating for locked shapes #1433 -- Annotation uploading fails in annotation view #1433 +- Hide functionality (H) doesn't work () +- The highlighted attribute doesn't correspond to the chosen attribute in AAM () +- Inconvinient image shaking while drawing a polygon (hold Alt key during drawing/editing/grouping to drag an image) () +- Filter property "shape" doesn't work and extra operator in description () +- Block of text information doesn't disappear after deactivating for locked shapes () +- Annotation uploading fails in annotation view () ### Security - From ce200088b93084de4928f9cde7cb8cf769fdf5c4 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 22 Apr 2020 01:44:08 +0300 Subject: [PATCH 09/11] Fixed UI freezes after exiting from multiple paste #1438 --- cvat-canvas/src/typescript/canvasView.ts | 9 ++------- cvat-canvas/src/typescript/drawHandler.ts | 14 +++++++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/cvat-canvas/src/typescript/canvasView.ts b/cvat-canvas/src/typescript/canvasView.ts index 43ff1c99e60b..57b0e0e2388a 100644 --- a/cvat-canvas/src/typescript/canvasView.ts +++ b/cvat-canvas/src/typescript/canvasView.ts @@ -98,7 +98,7 @@ export class CanvasViewImpl implements CanvasView, Listener { }); this.canvas.dispatchEvent(event); - } else { + } else if (!continueDraw) { const event: CustomEvent = new CustomEvent('canvas.canceled', { bubbles: false, cancelable: true, @@ -107,12 +107,7 @@ export class CanvasViewImpl implements CanvasView, Listener { this.canvas.dispatchEvent(event); } - if (continueDraw) { - this.drawHandler.draw( - this.controller.drawData, - this.geometry, - ); - } else { + if (!continueDraw) { this.mode = Mode.IDLE; this.controller.draw({ enabled: false, diff --git a/cvat-canvas/src/typescript/drawHandler.ts b/cvat-canvas/src/typescript/drawHandler.ts index c97d82551955..327d845fa7f5 100644 --- a/cvat-canvas/src/typescript/drawHandler.ts +++ b/cvat-canvas/src/typescript/drawHandler.ts @@ -168,9 +168,7 @@ export class DrawHandlerImpl implements DrawHandler { this.removeCrosshair(); } - if (!this.drawData.initialState) { - this.onDrawDone(null); - } + this.onDrawDone(null); } private initDrawing(): void { @@ -374,7 +372,10 @@ export class DrawHandlerImpl implements DrawHandler { .map((coord: string): number => +coord); const { points } = this.getFinalPolyshapeCoordinates(targetPoints); - this.release(); + if (!e.detail.originalEvent.ctrlKey) { + this.release(); + } + this.onDrawDone({ shapeType: this.drawData.initialState.shapeType, objectType: this.drawData.initialState.objectType, @@ -414,7 +415,10 @@ export class DrawHandlerImpl implements DrawHandler { this.drawInstance.on('done', (e: CustomEvent): void => { const bbox = this.drawInstance.node.getBBox(); const [xtl, ytl, xbr, ybr] = this.getFinalRectCoordinates(bbox); - this.release(); + if (!e.detail.originalEvent.ctrlKey) { + this.release(); + } + this.onDrawDone({ shapeType: this.drawData.initialState.shapeType, objectType: this.drawData.initialState.objectType, From e5a3a40a63a595406b26bed210daee70bac8a10f Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 22 Apr 2020 01:44:57 +0300 Subject: [PATCH 10/11] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86ff169733ea..e9b0c22b14c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Filter property "shape" doesn't work and extra operator in description () - Block of text information doesn't disappear after deactivating for locked shapes () - Annotation uploading fails in annotation view () +- UI freezes after canceling pasting with escape () ### Security - From 0eebd110e999aa90d398a126b0e7af5631321224 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 22 Apr 2020 14:57:40 +0300 Subject: [PATCH 11/11] which -> button --- cvat-canvas/src/typescript/canvasView.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cvat-canvas/src/typescript/canvasView.ts b/cvat-canvas/src/typescript/canvasView.ts index 57b0e0e2388a..4fbdadeb41db 100644 --- a/cvat-canvas/src/typescript/canvasView.ts +++ b/cvat-canvas/src/typescript/canvasView.ts @@ -667,9 +667,9 @@ export class CanvasViewImpl implements CanvasView, Listener { }); this.content.addEventListener('mousedown', (event): void => { - if ([1, 2].includes(event.which)) { + if ([0, 1].includes(event.button)) { if ([Mode.IDLE, Mode.DRAG, Mode.MERGE, Mode.SPLIT].includes(this.mode) - || event.which === 2 || event.altKey + || event.button === 1 || event.altKey ) { self.controller.enableDrag(event.clientX, event.clientY); }