diff --git a/CHANGELOG.md b/CHANGELOG.md index f0612ddbaa4d..7ad5d14082d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Git application name (renamed to dataset_repo) () - A problem in exporting of tracks, where tracks could be truncated () - Fixed CVAT startup process if the user has `umask 077` in .bashrc file () +- Exception: Cannot read property "each" of undefined after drawing a single point () ### Security diff --git a/cvat-canvas/package-lock.json b/cvat-canvas/package-lock.json index 5e60578ab16b..729f2e5303ec 100644 --- a/cvat-canvas/package-lock.json +++ b/cvat-canvas/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-canvas", - "version": "2.1.2", + "version": "2.1.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-canvas/package.json b/cvat-canvas/package.json index 9c07ef7ff317..a41a5f11dff4 100644 --- a/cvat-canvas/package.json +++ b/cvat-canvas/package.json @@ -1,6 +1,6 @@ { "name": "cvat-canvas", - "version": "2.1.2", + "version": "2.1.3", "description": "Part of Computer Vision Annotation Tool which presents its canvas library", "main": "src/canvas.ts", "scripts": { diff --git a/cvat-canvas/src/typescript/drawHandler.ts b/cvat-canvas/src/typescript/drawHandler.ts index 6716ead0622a..18902e3177cc 100644 --- a/cvat-canvas/src/typescript/drawHandler.ts +++ b/cvat-canvas/src/typescript/drawHandler.ts @@ -311,12 +311,16 @@ export class DrawHandlerImpl implements DrawHandler { const sizeDecrement = (): void => { if (--size === 0) { - this.drawInstance.draw('done'); + // we need additional settimeout because we cannot invoke draw('done') + // from event listener for drawstart event + // because of implementation of svg.js + setTimeout((): void => this.drawInstance.draw('done')); } }; this.drawInstance.on('drawstart', sizeDecrement); this.drawInstance.on('drawpoint', sizeDecrement); + this.drawInstance.on('drawupdate', (): void => this.transform(this.geometry)); this.drawInstance.on('undopoint', (): number => size++); // Add ability to cancel the latest drawn point diff --git a/cvat-canvas/src/typescript/editHandler.ts b/cvat-canvas/src/typescript/editHandler.ts index 413beda73665..b1ea9a1e0000 100644 --- a/cvat-canvas/src/typescript/editHandler.ts +++ b/cvat-canvas/src/typescript/editHandler.ts @@ -122,7 +122,8 @@ export class EditHandlerImpl implements EditHandler { this.transform(this.geometry); lastDrawnPoint.x = e.detail.event.clientX; lastDrawnPoint.y = e.detail.event.clientY; - }).draw(dummyEvent, { snapToGrid: 0.1 }); + }).on('drawupdate', (): void => this.transform(this.geometry)) + .draw(dummyEvent, { snapToGrid: 0.1 }); if (this.editData.state.shapeType === 'points') { this.editLine.attr('stroke-width', 0);