From 80e8a7bf2214812a492b84372d00c3bf3dd3b438 Mon Sep 17 00:00:00 2001 From: Boris Sekachev <40690378+bsekachev@users.noreply.github.com> Date: Fri, 17 May 2019 14:31:18 +0300 Subject: [PATCH] Fixed: Cannot read property 'split' of undefined for interpolation points (#455) --- cvat/apps/engine/static/engine/js/shapes.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cvat/apps/engine/static/engine/js/shapes.js b/cvat/apps/engine/static/engine/js/shapes.js index 6763abd3..2ff5c4e9 100644 --- a/cvat/apps/engine/static/engine/js/shapes.js +++ b/cvat/apps/engine/static/engine/js/shapes.js @@ -951,9 +951,14 @@ class PolyShapeModel extends ShapeModel { if (this._verifyArea(box)) { if (!silent) { // Undo/redo code - let oldPos = Object.assign({}, this._positions[frame]); + const oldPos = Object.assign({}, this._positions[frame]); window.cvat.addAction('Change Position', () => { - this.updatePosition(frame, oldPos, false); + if (!Object.keys(oldPos).length) { + delete this._positions[frame]; + this.notify('position'); + } else { + this.updatePosition(frame, oldPos, false); + } }, () => { this.updatePosition(frame, pos, false); }, frame); @@ -961,7 +966,7 @@ class PolyShapeModel extends ShapeModel { } if (this._type.startsWith('annotation')) { - if (this._frame != frame) { + if (this._frame !== frame) { throw Error(`Got bad frame for annotation poly shape during update position: ${frame}. Own frame is ${this._frame}`); } this._positions[frame] = pos; @@ -2979,6 +2984,11 @@ class PolyShapeView extends ShapeView { }); point.on('dblclick.polyshapeEditor', (e) => { + if (this._controller.type === 'interpolation_points') { + // Not available for interpolation points + return; + } + if (e.shiftKey) { if (!window.cvat.mode) { // Get index before detach shape from DOM