From fd3e896cb06e25c42d66896af259ac5f95ded848 Mon Sep 17 00:00:00 2001 From: Priya4607 Date: Mon, 23 Mar 2020 17:14:18 +0530 Subject: [PATCH] resolved merge conflicts --- cvat-canvas/src/typescript/canvasModel.ts | 1 + cvat-canvas/src/typescript/canvasView.ts | 35 +++++-- cvat-canvas/src/typescript/drawHandler.ts | 16 ++++ cvat-core/src/annotations-collection.js | 2 + cvat-core/src/annotations-objects.js | 93 +++++++++++++++++++ cvat-core/src/annotations-saver.js | 2 +- cvat-core/src/api.js | 2 + cvat-core/src/enums.js | 19 +++- cvat-core/src/object-state.js | 19 +++- .../standard-workspace/canvas-wrapper.tsx | 2 + 10 files changed, 181 insertions(+), 10 deletions(-) diff --git a/cvat-canvas/src/typescript/canvasModel.ts b/cvat-canvas/src/typescript/canvasModel.ts index f72bc6324701..765cc5d8a13b 100644 --- a/cvat-canvas/src/typescript/canvasModel.ts +++ b/cvat-canvas/src/typescript/canvasModel.ts @@ -47,6 +47,7 @@ export interface DrawData { numberOfPoints?: number; initialState?: any; crosshair?: boolean; + annotation_type?: string; } export interface EditData { diff --git a/cvat-canvas/src/typescript/canvasView.ts b/cvat-canvas/src/typescript/canvasView.ts index 5db41045586a..b89080b4fe40 100644 --- a/cvat-canvas/src/typescript/canvasView.ts +++ b/cvat-canvas/src/typescript/canvasView.ts @@ -37,6 +37,7 @@ import { Mode, Size, } from './canvasModel'; +import { isNullOrUndefined } from 'util'; export interface CanvasView { html(): HTMLDivElement; @@ -114,14 +115,15 @@ export class CanvasViewImpl implements CanvasView, Listener { } } - private onEditDone(state: any, points: number[]): void { - if (state && points) { + private onEditDone(state: any, points: number[], annotation_type: string): void { + if (state && points && annotation_type) { const event: CustomEvent = new CustomEvent('canvas.edited', { bubbles: false, cancelable: true, detail: { state, points, + annotation_type, }, }); @@ -433,9 +435,11 @@ export class CanvasViewImpl implements CanvasView, Listener { )); if (e.ctrlKey) { const { points } = state; + const annotation_type = 'Manual'; self.onEditDone( state, points.slice(0, pointID * 2).concat(points.slice(pointID * 2 + 2)), + annotation_type, ); } else if (e.shiftKey) { self.canvas.dispatchEvent(new CustomEvent('canvas.editstart', { @@ -859,6 +863,7 @@ export class CanvasViewImpl implements CanvasView, Listener { attributes: { ...state.attributes }, zOrder: state.zOrder, pinned: state.pinned, + annotation_type: state.annotation_type, }; } @@ -1174,7 +1179,8 @@ export class CanvasViewImpl implements CanvasView, Listener { id: state.clientID, }, })); - this.onEditDone(state, points); + const annotation_type = 'Manual'; + this.onEditDone(state, points, annotation_type); } }); } @@ -1222,6 +1228,7 @@ export class CanvasViewImpl implements CanvasView, Listener { + `${shape.attr('x') + shape.attr('width')},` + `${shape.attr('y') + shape.attr('height')}`, ).map((x: number): number => x - offset); + const annotation_type = 'Manual'; this.drawnStates[state.clientID].points = points; this.canvas.dispatchEvent(new CustomEvent('canvas.resizeshape', { @@ -1231,7 +1238,7 @@ export class CanvasViewImpl implements CanvasView, Listener { id: state.clientID, }, })); - this.onEditDone(state, points); + this.onEditDone(state, points, annotation_type); } }); @@ -1313,14 +1320,14 @@ export class CanvasViewImpl implements CanvasView, Listener { } private addText(state: any): SVG.Text { - const { label, clientID, attributes } = state; + const { label, clientID, attributes, annotation_type } = state; const attrNames = label.attributes.reduce((acc: any, val: any): void => { acc[val.id] = val.name; return acc; }, {}); return this.adoptedText.text((block): void => { - block.tspan(`${label.name} ${clientID}`).style('text-transform', 'uppercase'); + block.tspan(`${label.name} ${clientID} (${annotation_type})`).style('text-transform', 'uppercase'); for (const attrID of Object.keys(attributes)) { block.tspan(`${attrNames[attrID]}: ${attributes[attrID]}`).attr({ attrID, @@ -1333,6 +1340,9 @@ export class CanvasViewImpl implements CanvasView, Listener { private addRect(points: number[], state: any): SVG.Rect { const [xtl, ytl, xbr, ybr] = points; + if (typeof (state.annotation_type) === 'undefined') { + state.annotation_type = 'Manual'; + } const rect = this.adoptedContent.rect().size(xbr - xtl, ybr - ytl).attr({ clientID: state.clientID, 'color-rendering': 'optimizeQuality', @@ -1342,6 +1352,7 @@ export class CanvasViewImpl implements CanvasView, Listener { stroke: state.color, 'stroke-width': consts.BASE_STROKE_WIDTH / this.geometry.scale, 'data-z-order': state.zOrder, + annotation_type: state.annotation_type, }).move(xtl, ytl) .addClass('cvat_canvas_shape'); @@ -1357,6 +1368,9 @@ export class CanvasViewImpl implements CanvasView, Listener { } private addPolygon(points: string, state: any): SVG.Polygon { + if (typeof (state.annotation_type) === 'undefined') { + state.annotation_type = 'Manual'; + } const polygon = this.adoptedContent.polygon(points).attr({ clientID: state.clientID, 'color-rendering': 'optimizeQuality', @@ -1366,6 +1380,7 @@ export class CanvasViewImpl implements CanvasView, Listener { stroke: state.color, 'stroke-width': consts.BASE_STROKE_WIDTH / this.geometry.scale, 'data-z-order': state.zOrder, + annotation_type: state.annotation_type, }).addClass('cvat_canvas_shape'); if (state.occluded) { @@ -1380,6 +1395,9 @@ export class CanvasViewImpl implements CanvasView, Listener { } private addPolyline(points: string, state: any): SVG.PolyLine { + if (typeof (state.annotation_type) === 'undefined') { + state.annotation_type = 'Manual'; + } const polyline = this.adoptedContent.polyline(points).attr({ clientID: state.clientID, 'color-rendering': 'optimizeQuality', @@ -1389,6 +1407,7 @@ export class CanvasViewImpl implements CanvasView, Listener { stroke: state.color, 'stroke-width': consts.BASE_STROKE_WIDTH / this.geometry.scale, 'data-z-order': state.zOrder, + annotation_type: state.annotation_type, }).addClass('cvat_canvas_shape'); if (state.occluded) { @@ -1424,12 +1443,14 @@ export class CanvasViewImpl implements CanvasView, Listener { } private addPoints(points: string, state: any): SVG.PolyLine { + state.annotation_type = 'Manual'; const shape = this.adoptedContent.polyline(points).attr({ 'color-rendering': 'optimizeQuality', 'pointer-events': 'none', 'shape-rendering': 'geometricprecision', 'stroke-width': 0, - fill: state.color, // to right fill property when call SVG.Shape::clone() + fill: state.color, // to right fill property when call SVG.Shape::clone( + annotation_type: state.annotation_type, }).style({ opacity: 0, }); diff --git a/cvat-canvas/src/typescript/drawHandler.ts b/cvat-canvas/src/typescript/drawHandler.ts index 4afe75ec259d..839146f45bb0 100644 --- a/cvat-canvas/src/typescript/drawHandler.ts +++ b/cvat-canvas/src/typescript/drawHandler.ts @@ -178,9 +178,11 @@ export class DrawHandlerImpl implements DrawHandler { this.cancel(); if ((xbr - xtl) * (ybr - ytl) >= consts.AREA_THRESHOLD) { + this.drawData.annotation_type = 'Manual'; this.onDrawDone({ shapeType, points: [xtl, ytl, xbr, ybr], + annotation_type: this.drawData.annotation_type, }, Date.now() - this.startTimestamp); } }).on('drawupdate', (): void => { @@ -211,9 +213,11 @@ export class DrawHandlerImpl implements DrawHandler { this.cancel(); if ((xbr - xtl) * (ybr - ytl) >= consts.AREA_THRESHOLD) { + this.drawData.annotation_type = 'Manual'; this.onDrawDone({ shapeType, points: [xtl, ytl, xbr, ybr], + annotation_type: this.drawData.annotation_type, }, Date.now() - this.startTimestamp); } } @@ -298,23 +302,29 @@ export class DrawHandlerImpl implements DrawHandler { if (shapeType === 'polygon' && ((box.xbr - box.xtl) * (box.ybr - box.ytl) >= consts.AREA_THRESHOLD) && points.length >= 3 * 2) { + this.drawData.annotation_type = 'Manual'; this.onDrawDone({ shapeType, points, + annotation_type: this.drawData.annotation_type, }, Date.now() - this.startTimestamp); } else if (shapeType === 'polyline' && ((box.xbr - box.xtl) >= consts.SIZE_THRESHOLD || (box.ybr - box.ytl) >= consts.SIZE_THRESHOLD) && points.length >= 2 * 2) { + this.drawData.annotation_type = 'Manual'; this.onDrawDone({ shapeType, points, + annotation_type: this.drawData.annotation_type, }, Date.now() - this.startTimestamp); } else if (shapeType === 'points' && (e.target as any).getAttribute('points') !== '0,0') { + this.drawData.annotation_type = 'Manual'; this.onDrawDone({ shapeType, points, + annotation_type: this.drawData.annotation_type, }, Date.now() - this.startTimestamp); } }); @@ -358,6 +368,7 @@ export class DrawHandlerImpl implements DrawHandler { const { points } = this.getFinalPolyshapeCoordinates(targetPoints); this.release(); + this.drawData.annotation_type = 'Manual'; this.onDrawDone({ shapeType: this.drawData.initialState.shapeType, objectType: this.drawData.initialState.objectType, @@ -366,6 +377,7 @@ export class DrawHandlerImpl implements DrawHandler { attributes: { ...this.drawData.initialState.attributes }, label: this.drawData.initialState.label, color: this.drawData.initialState.color, + annotation_type: this.drawData.annotation_type, }, Date.now() - this.startTimestamp, e.detail.originalEvent.ctrlKey); }); } @@ -398,6 +410,7 @@ export class DrawHandlerImpl implements DrawHandler { const bbox = this.drawInstance.node.getBBox(); const [xtl, ytl, xbr, ybr] = this.getFinalRectCoordinates(bbox); this.release(); + this.drawData.annotation_type = 'Manual'; this.onDrawDone({ shapeType: this.drawData.initialState.shapeType, objectType: this.drawData.initialState.objectType, @@ -406,6 +419,7 @@ export class DrawHandlerImpl implements DrawHandler { attributes: { ...this.drawData.initialState.attributes }, label: this.drawData.initialState.label, color: this.drawData.initialState.color, + annotation_type: this.drawData.annotation_type, }, Date.now() - this.startTimestamp, e.detail.originalEvent.ctrlKey); }); } @@ -540,6 +554,7 @@ export class DrawHandlerImpl implements DrawHandler { if (this.drawData.initialState) { const { offset } = this.geometry; if (this.drawData.shapeType === 'rectangle') { + this.drawData.annotation_type = 'Manual'; const [xtl, ytl, xbr, ybr] = this.drawData.initialState.points .map((coord: number): number => coord + offset); @@ -566,6 +581,7 @@ export class DrawHandlerImpl implements DrawHandler { } else { if (this.drawData.shapeType === 'rectangle') { if (this.drawData.rectDrawingMethod === RectDrawingMethod.EXTREME_POINTS) { + this.drawData.annotation_type = 'Manual'; // draw box by extreme clicking this.drawBoxBy4Points(); } else { diff --git a/cvat-core/src/annotations-collection.js b/cvat-core/src/annotations-collection.js index 309d387d3122..ae80a4736944 100644 --- a/cvat-core/src/annotations-collection.js +++ b/cvat-core/src/annotations-collection.js @@ -748,6 +748,7 @@ points: [...state.points], type: state.shapeType, z_order: state.zOrder, + annotation_type: state.annotation_type, }); } else if (state.objectType === 'track') { constructed.tracks.push({ @@ -765,6 +766,7 @@ points: [...state.points], type: state.shapeType, z_order: state.zOrder, + annotation_type: state.annotation_type, }], }); } else { diff --git a/cvat-core/src/annotations-objects.js b/cvat-core/src/annotations-objects.js index 245d8e375c10..c4bf8f6df95d 100644 --- a/cvat-core/src/annotations-objects.js +++ b/cvat-core/src/annotations-objects.js @@ -19,6 +19,7 @@ ObjectType, AttributeType, HistoryActions, + AnnotationType, } = require('./enums'); const { @@ -149,6 +150,7 @@ this.removed = false; this.lock = false; this.color = color; + this.annotation_type = data.annotation_type; this.updated = Date.now(); this.attributes = data.attributes.reduce((attributeAccumulator, attr) => { attributeAccumulator[attr.spec_id] = attr.value; @@ -251,6 +253,19 @@ }, [this.clientID]); } + _saveAnnotationType(annotation_type) { + const undoannotation_type = this.annotation_type; + const redoannotation_type = annotation_type; + + this.history.do(HistoryActions.CHANGED_ANNOTATIONTYPE, () => { + this.annotation_type = undoannotation_type; + }, () => { + this.annotation_type = redoannotation_type; + }, [this.clientID]); + + this.annotation_type = annotation_type; + } + _validateStateBeforeSave(frame, data, updated) { let fittedPoints = []; @@ -346,6 +361,10 @@ } } + if (updated.annotation_type) { + checkObjectType('annotation_type', data.annotation_type, 'string', null); + } + return fittedPoints; } @@ -430,6 +449,7 @@ this.points = data.points; this.occluded = data.occluded; this.zOrder = data.z_order; + this.annotation_type = data.annotation_type; } // Method is used to export data to the server @@ -452,6 +472,7 @@ frame: this.frame, label_id: this.label.id, group: this.group, + annotation_type: this.annotation_type, }; } @@ -480,6 +501,7 @@ updated: this.updated, pinned: this.pinned, frame, + annotation_type:this.annotation_type, }; } @@ -522,6 +544,22 @@ this.zOrder = zOrder; } + _saveAnnotationType(annotation_type) { + const undoannotation_type = this.annotation_type; + const redoannotation_type = annotation_type; + + this.history.do(HistoryActions.CHANGED_ANNOTATIONTYPE, () => { + this.annotation_type = undoannotation_type; + }, () => { + this.annotation_type = redoannotation_type; + }, [this.clientID]); + + this.annotation_type = annotation_type; + } + + + + save(frame, data) { if (frame !== this.frame) { throw new ScriptingError( @@ -573,6 +611,10 @@ this._saveHidden(data.hidden); } + if (updated.annotation_type) { + this._saveAnnotationType(data.annotation_type); + } + this.updateTimestamp(updated); updated.reset(); @@ -590,6 +632,7 @@ zOrder: value.z_order, points: value.points, outside: value.outside, + annotation_type: value.annotation_type, attributes: value.attributes.reduce((attributeAccumulator, attr) => { attributeAccumulator[attr.spec_id] = attr.value; return attributeAccumulator; @@ -643,6 +686,7 @@ }, []), id: this.shapes[frame].serverID, frame: +frame, + annotation_type: this.annotation_type, }); return shapesAccumulator; @@ -680,6 +724,7 @@ last, }, frame, + annotation_type: this.annotation_type, }; } @@ -830,6 +875,7 @@ outside: current.outside, occluded: current.occluded, attributes: {}, + annotation_type: current.annotation_type, }; } } @@ -888,6 +934,7 @@ outside: current.outside, occluded: current.occluded, attributes: {}, + annotation_type: current.annotation_type, }; this.shapes[frame] = redoShape; @@ -910,6 +957,7 @@ points: current.points, occluded: current.occluded, attributes: {}, + annotation_type: current.annotation_type, }; this.shapes[frame] = redoShape; @@ -932,6 +980,7 @@ points: current.points, outside: current.outside, attributes: {}, + annotation_type: current.annotation_type, }; this.shapes[frame] = redoShape; @@ -954,6 +1003,7 @@ points: current.points, outside: current.outside, attributes: {}, + annotation_type: current.annotation_type, }; this.shapes[frame] = redoShape; @@ -965,6 +1015,29 @@ ); } + _saveAnnotationType(frame, annotation_type) { + const current = this.get(frame); + const wasKeyframe = frame in this.shapes; + const undoShape = wasKeyframe ? this.shapes[frame] : undefined; + const redoShape = wasKeyframe ? { ...this.shapes[frame], annotation_type } : { + frame, + annotation_type, + zOrder: current.zOrder, + points: current.points, + occluded: current.occluded, + outside: current.outside, + attributes: {}, + }; + + this.shapes[frame] = redoShape; + this._appendShapeActionToHistory( + HistoryActions.CHANGED_ANNOTATIONTYPE, + frame, + undoShape, + redoShape, + ); + } + _saveKeyframe(frame, keyframe) { const current = this.get(frame); const wasKeyframe = frame in this.shapes; @@ -982,6 +1055,7 @@ outside: current.outside, occluded: current.occluded, attributes: {}, + annotation_type: current.annotation_type, } : undefined; if (redoShape) { @@ -1046,6 +1120,10 @@ this._saveAttributes(frame, data.attributes); } + if (updated.annotation_type) { + this._saveAnnotationType(frame, data.annotation_type); + } + if (updated.keyframe) { this._saveKeyframe(frame, data.keyframe); } @@ -1102,6 +1180,7 @@ class Tag extends Annotation { constructor(data, clientID, color, injection) { super(data, clientID, color, injection); + this.annotation_type = data.annotation_type; } // Method is used to export data to the server @@ -1112,6 +1191,7 @@ frame: this.frame, label_id: this.label.id, group: this.group, + annotation_type: this.annotation_type, attributes: Object.keys(this.attributes).reduce((attributeAccumulator, attrId) => { attributeAccumulator.push({ spec_id: attrId, @@ -1142,6 +1222,7 @@ color: this.color, updated: this.updated, frame, + annotation_type: this.annotation_type, }; } @@ -1176,6 +1257,10 @@ this._saveColor(data.color); } + if (updated.annotation_type) { + this._saveAnnotationType(data.annotation_type); + } + this.updateTimestamp(updated); updated.reset(); @@ -1188,6 +1273,7 @@ super(data, clientID, color, injection); this.shapeType = ObjectShape.RECTANGLE; this.pinned = false; + this.annotation_type = data.annotation_type; checkNumberOfPoints(this.shapeType, this.points); } @@ -1214,6 +1300,7 @@ constructor(data, clientID, color, injection) { super(data, clientID, color, injection); this.shapeType = ObjectShape.POLYGON; + this.annotation_type = data.annotation_type; checkNumberOfPoints(this.shapeType, this.points); } @@ -1289,6 +1376,7 @@ constructor(data, clientID, color, injection) { super(data, clientID, color, injection); this.shapeType = ObjectShape.POLYLINE; + this.annotation_type = data.annotation_type; checkNumberOfPoints(this.shapeType, this.points); } @@ -1333,6 +1421,7 @@ constructor(data, clientID, color, injection) { super(data, clientID, color, injection); this.shapeType = ObjectShape.POINTS; + this.annotation_type = data.annotation_type; checkNumberOfPoints(this.shapeType, this.points); } @@ -1356,6 +1445,7 @@ super(data, clientID, color, injection); this.shapeType = ObjectShape.RECTANGLE; this.pinned = false; + this.annotation_type = AnnotationType.MANUAL; for (const shape of Object.values(this.shapes)) { checkNumberOfPoints(this.shapeType, shape.points); } @@ -1774,6 +1864,7 @@ constructor(data, clientID, color, injection) { super(data, clientID, color, injection); this.shapeType = ObjectShape.POLYGON; + this.annotation_type = AnnotationType.MANUAL; for (const shape of Object.values(this.shapes)) { checkNumberOfPoints(this.shapeType, shape.points); } @@ -1784,6 +1875,7 @@ constructor(data, clientID, color, injection) { super(data, clientID, color, injection); this.shapeType = ObjectShape.POLYLINE; + this.annotation_type = AnnotationType.MANUAL; for (const shape of Object.values(this.shapes)) { checkNumberOfPoints(this.shapeType, shape.points); } @@ -1794,6 +1886,7 @@ constructor(data, clientID, color, injection) { super(data, clientID, color, injection); this.shapeType = ObjectShape.POINTS; + this.annotation_type = AnnotationType.MANUAL; for (const shape of Object.values(this.shapes)) { checkNumberOfPoints(this.shapeType, shape.points); } diff --git a/cvat-core/src/annotations-saver.js b/cvat-core/src/annotations-saver.js index 42a07ecb39d4..d99e3370511e 100644 --- a/cvat-core/src/annotations-saver.js +++ b/cvat-core/src/annotations-saver.js @@ -104,7 +104,7 @@ const keys = ['id', 'label_id', 'group', 'frame', 'occluded', 'z_order', 'points', 'type', 'shapes', - 'attributes', 'value', 'spec_id', 'outside']; + 'attributes', 'value', 'spec_id', 'annotation_type', 'outside']; // Find created and updated objects for (const type of Object.keys(exported)) { diff --git a/cvat-core/src/api.js b/cvat-core/src/api.js index 4eb4e99af00b..f1da5071889d 100644 --- a/cvat-core/src/api.js +++ b/cvat-core/src/api.js @@ -31,6 +31,7 @@ function build() { LogType, HistoryActions, colors, + AnnotationType, } = require('./enums'); const { @@ -529,6 +530,7 @@ function build() { LogType, HistoryActions, colors, + AnnotationType, }, /** * Namespace is used for access to exceptions diff --git a/cvat-core/src/enums.js b/cvat-core/src/enums.js index 8b6c86fcaab4..569575303529 100644 --- a/cvat-core/src/enums.js +++ b/cvat-core/src/enums.js @@ -102,9 +102,23 @@ POINTS: 'points', }); + /** + * Annotation type + * @enum {string} + * @name AnnotationType + * @memberof module:API.cvat.enums + * @property {string} MANUAL 'Manual' + * @property {string} AUTO 'Auto' + * @readonly + */ + const AnnotationType = Object.freeze({ + MANUAL:'Manual', + AUTO:'Auto', +}); + /** * Logger event types - * @enum {string} + * @enum {string} * @name LogType * @memberof module:API.cvat.enums * @property {string} loadJob Load job @@ -186,6 +200,7 @@ * @property {string} CHANGED_LOCK Changed lock * @property {string} CHANGED_COLOR Changed color * @property {string} CHANGED_HIDDEN Changed hidden + * @property {string} CHANGED_ANNOTATIONTYPE Changed annotation_type * @property {string} MERGED_OBJECTS Merged objects * @property {string} SPLITTED_TRACK Splitted track * @property {string} GROUPED_OBJECTS Grouped objects @@ -205,6 +220,7 @@ CHANGED_PINNED: 'Changed pinned', CHANGED_COLOR: 'Changed color', CHANGED_HIDDEN: 'Changed hidden', + CHANGED_ANNOTATIONTYPE: 'Changed annotation_type', MERGED_OBJECTS: 'Merged objects', SPLITTED_TRACK: 'Splitted track', GROUPED_OBJECTS: 'Grouped objects', @@ -236,5 +252,6 @@ LogType, HistoryActions, colors, + AnnotationType, }; })(); diff --git a/cvat-core/src/object-state.js b/cvat-core/src/object-state.js index e6a42f188afe..99453940ba9e 100644 --- a/cvat-core/src/object-state.js +++ b/cvat-core/src/object-state.js @@ -22,7 +22,7 @@ *
Necessary fields: objectType, shapeType, frame, updated, group *
Optional fields: keyframes, clientID, serverID *
Optional fields which can be set later: points, zOrder, outside, - * occluded, hidden, attributes, lock, label, color, keyframe + * occluded, hidden, attributes, lock, label, color, keyframe, annotation_type */ constructor(serialized) { const data = { @@ -39,6 +39,7 @@ color: null, hidden: null, pinned: null, + annotation_type: null, keyframes: serialized.keyframes, group: serialized.group, updated: serialized.updated, @@ -68,6 +69,7 @@ this.lock = false; this.color = false; this.hidden = false; + this.annotation_type = false; return reset; }, @@ -109,6 +111,20 @@ */ get: () => data.shapeType, }, + annotation_type: { + /** + * @name annotation_type + * @type {module:API.cvat.enums.AnnotationType} + * @memberof module:API.cvat.classes.ObjectState + * @readonly + * @instance + */ + get: () => data.annotation_type, + set: (annotation_type) => { + data.updateFlags.annotation_type = true; + data.annotation_type = annotation_type; + }, + }, clientID: { /** * @name clientID @@ -343,6 +359,7 @@ this.label = serialized.label; this.lock = serialized.lock; + this.annotation_type = serialized.annotation_type; if (typeof (serialized.zOrder) === 'number') { this.zOrder = serialized.zOrder; diff --git a/cvat-ui/src/components/annotation-page/standard-workspace/canvas-wrapper.tsx b/cvat-ui/src/components/annotation-page/standard-workspace/canvas-wrapper.tsx index 16bc2e3ec144..ae2338ed9739 100644 --- a/cvat-ui/src/components/annotation-page/standard-workspace/canvas-wrapper.tsx +++ b/cvat-ui/src/components/annotation-page/standard-workspace/canvas-wrapper.tsx @@ -422,8 +422,10 @@ export default class CanvasWrapperComponent extends React.PureComponent { const { state, points, + annotation_type, } = event.detail; state.points = points; + state.annotation_type = annotation_type; onUpdateAnnotations([state]); };