Skip to content

Commit

Permalink
Fixed bug: 'Cannot read property each of undefined', fixed points size (
Browse files Browse the repository at this point in the history
#2307)

* Fixed bug: 'Cannot read property each of undefined', fixed points size

* Updated version, updated changelog
  • Loading branch information
bsekachev authored Oct 12, 2020
1 parent 796a8d3 commit df6e6fd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) (<https://github.com/openvinotoolkit/cvat/pull/2243>)
- A problem in exporting of tracks, where tracks could be truncated (<https://github.com/openvinotoolkit/cvat/issues/2129>)
- Fixed CVAT startup process if the user has `umask 077` in .bashrc file (<https://github.com/openvinotoolkit/cvat/pull/2293>)
- Exception: Cannot read property "each" of undefined after drawing a single point (<https://github.com/openvinotoolkit/cvat/pull/2307>)

### Security

Expand Down
2 changes: 1 addition & 1 deletion cvat-canvas/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cvat-canvas/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
6 changes: 5 additions & 1 deletion cvat-canvas/src/typescript/drawHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cvat-canvas/src/typescript/editHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit df6e6fd

Please sign in to comment.