From 7850f1e9b1a504a924c4400226befc694aa157a2 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 5 Oct 2022 16:47:35 +0300 Subject: [PATCH] Fixed changing label color on canvas (#5045) * Fixed changing label color on canvas * Updated changelog --- CHANGELOG.md | 1 + cvat-canvas/package.json | 2 +- cvat-canvas/src/typescript/canvasView.ts | 11 ++++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 301d9bdd7b8f..6a06c0e28d9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ non-ascii paths while adding files from "Connected file share" (issue #4428) () - Project import/export with skeletons (, ) +- Shape color is not changed on canvas after changing a label () - Unstable e2e restore tests () - IOG and f-BRS serverless function () diff --git a/cvat-canvas/package.json b/cvat-canvas/package.json index ee8180b44cbb..c9cee7a7b476 100644 --- a/cvat-canvas/package.json +++ b/cvat-canvas/package.json @@ -1,6 +1,6 @@ { "name": "cvat-canvas", - "version": "2.15.3", + "version": "2.15.4", "description": "Part of Computer Vision Annotation Tool which presents its canvas library", "main": "src/canvas.ts", "scripts": { diff --git a/cvat-canvas/src/typescript/canvasView.ts b/cvat-canvas/src/typescript/canvasView.ts index c120cd730749..9402a813d24c 100644 --- a/cvat-canvas/src/typescript/canvasView.ts +++ b/cvat-canvas/src/typescript/canvasView.ts @@ -1864,7 +1864,7 @@ export class CanvasViewImpl implements CanvasView, Listener { drawnStateDescriptions.length !== stateDescriptions.length || drawnStateDescriptions.some((desc: string, id: number): boolean => desc !== stateDescriptions[id]) ) { - // need to remove created text and create it again + // remove created text and create it again if (text) { text.remove(); this.svgTexts[state.clientID] = this.addText(state); @@ -1884,6 +1884,15 @@ export class CanvasViewImpl implements CanvasView, Listener { } } + if (drawnState.label.id !== state.label.id || drawnState.color !== state.color) { + // update shape color if necessary + if (shape) { + shape.attr({ + ...this.getShapeColorization(state), + }); + } + } + if ( drawnState.group.id !== state.group.id || drawnState.group.color !== state.group.color ) {