Skip to content

Commit

Permalink
fixed issue with flickering masks
Browse files Browse the repository at this point in the history
  • Loading branch information
klakhov committed Nov 14, 2024
1 parent 0f90e06 commit 9f9f3b2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cvat-canvas/src/typescript/canvasView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2877,6 +2877,9 @@ export class CanvasViewImpl implements CanvasView, Listener {
const shapeView = window.document.getElementById(`cvat_canvas_shape_${clientID}`);
if (shapeView) shapeView.classList.remove(this.getHighlightClassname());
});
const redrawMasks = (highlightedElements.elementsIDs.length !== 0 ||
this.highlightedElements.elementsIDs.length !== 0);

if (highlightedElements.elementsIDs.length) {
this.highlightedElements = { ...highlightedElements };
this.canvas.classList.add('cvat-canvas-highlight-enabled');
Expand All @@ -2891,9 +2894,11 @@ export class CanvasViewImpl implements CanvasView, Listener {
};
this.canvas.classList.remove('cvat-canvas-highlight-enabled');
}
const masks = Object.values(this.drawnStates).filter((state) => state.shapeType === 'mask');
this.deleteObjects(masks);
this.addObjects(masks);
if (redrawMasks) {
const masks = Object.values(this.drawnStates).filter((state) => state.shapeType === 'mask');
this.deleteObjects(masks);
this.addObjects(masks);
}
if (this.highlightedElements.elementsIDs.length) {
this.deactivate();
const clientID = this.highlightedElements.elementsIDs[0];
Expand Down

0 comments on commit 9f9f3b2

Please sign in to comment.