Skip to content

Commit

Permalink
Fixed changing label color on canvas (#5045)
Browse files Browse the repository at this point in the history
* Fixed changing label color on canvas

* Updated changelog
  • Loading branch information
bsekachev authored Oct 5, 2022
1 parent 1902ecd commit 7850f1e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ non-ascii paths while adding files from "Connected file share" (issue #4428)
(<https://github.com/openvinotoolkit/cvat/pull/4659>)
- Project import/export with skeletons (<https://github.com/opencv/cvat/pull/4867>,
<https://github.com/opencv/cvat/pull/5004>)
- Shape color is not changed on canvas after changing a label (<https://github.com/opencv/cvat/pull/5045>)
- Unstable e2e restore tests (<https://github.com/opencv/cvat/pull/5010>)
- IOG and f-BRS serverless function (<https://github.com/opencv/cvat/pulls>)

Expand Down
2 changes: 1 addition & 1 deletion cvat-canvas/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
11 changes: 10 additions & 1 deletion cvat-canvas/src/typescript/canvasView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
) {
Expand Down

0 comments on commit 7850f1e

Please sign in to comment.