Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GSoC2024] added check for the attributes which aren't present for the specified clientID for a conflict of annotation #7776

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- added check for the attributes which aren't present for the specified clientID for a conflict of annotation
(<https://github.com/cvat-ai/cvat/pull/7776>)
68 changes: 35 additions & 33 deletions cvat-canvas/src/typescript/canvasView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2244,46 +2244,48 @@ export class CanvasViewImpl implements CanvasView, Listener {
if (this.activeElement.clientID) {
const { displayAllText } = this.configuration;
const { clientID } = this.activeElement;
const drawnState = this.drawnStates[clientID];
const shape = this.svgShapes[clientID];
const drawnState = (clientID in this.drawnStates) ? this.drawnStates[clientID] : null;
const shape = clientID in this.svgShapes ? this.svgShapes[clientID] : null;

if (shape !== null) {
if (drawnState !== null && drawnState.shapeType === 'points') {
this.svgShapes[clientID]
.remember('_selectHandler').nested
.removeClass('cvat_canvas_shape_activated');
} else {
shape.removeClass('cvat_canvas_shape_activated');
}
shape.removeClass('cvat_canvas_shape_draggable');
if (drawnState !== null && drawnState.shapeType === 'mask') {
shape.attr('opacity', `${this.configuration.shapeOpacity}`);
} else {
shape.attr('fill-opacity', `${this.configuration.shapeOpacity}`);
}

if (drawnState.shapeType === 'points') {
this.svgShapes[clientID]
.remember('_selectHandler').nested
.removeClass('cvat_canvas_shape_activated');
} else {
shape.removeClass('cvat_canvas_shape_activated');
}
shape.removeClass('cvat_canvas_shape_draggable');
if (drawnState.shapeType === 'mask') {
shape.attr('opacity', `${this.configuration.shapeOpacity}`);
} else {
shape.attr('fill-opacity', `${this.configuration.shapeOpacity}`);
}
if (drawnState !== null && !drawnState.pinned) {
(shape as any).off('dragstart');
(shape as any).off('dragend');
(shape as any).draggable(false);
}

if (!drawnState.pinned) {
(shape as any).off('dragstart');
(shape as any).off('dragend');
(shape as any).draggable(false);
}
if (drawnState !== null && drawnState.shapeType !== 'points') {
this.selectize(false, shape);
}

if (drawnState.shapeType !== 'points') {
this.selectize(false, shape);
}
if (drawnState !== null && drawnState.shapeType === 'cuboid') {
(shape as any).attr('projections', false);
}

if (drawnState.shapeType === 'cuboid') {
(shape as any).attr('projections', false);
}
if (drawnState !== null && drawnState.shapeType === 'mask') {
(shape as any).off('mousedown');
}

if (drawnState.shapeType === 'mask') {
(shape as any).off('mousedown');
(shape as any).off('resizestart');
(shape as any).off('resizing');
(shape as any).off('resizedone');
(shape as any).resize('stop');
}

(shape as any).off('resizestart');
(shape as any).off('resizing');
(shape as any).off('resizedone');
(shape as any).resize('stop');

// TODO: Hide text only if it is hidden by settings
const text = this.svgTexts[clientID];
if (text && !displayAllText) {
Expand Down