Skip to content

Commit

Permalink
Fix issue scaling on image filter appication (#9126)
Browse files Browse the repository at this point in the history
Fixed a problem when image filter application was resetting zoom for `issue` labels in review mode
  • Loading branch information
klakhov authored Feb 25, 2025
1 parent de42098 commit 163b64d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions changelog.d/20250224_103541_klakhov_fix_fit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- Issue label scaling on image filter application
(<https://github.com/cvat-ai/cvat/pull/9126>)
12 changes: 10 additions & 2 deletions cvat-canvas/src/typescript/canvasModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
};

this.data.image = data;
this.fit();
this.resetScale();

// restore correct image position after switching to a new frame
// if corresponding option is disabled
Expand Down Expand Up @@ -684,7 +684,7 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
this.notify(UpdateReasons.SHAPE_FOCUSED);
}

public fit(): void {
private resetScale(): boolean {
const { angle } = this.data;

let updatedScale = this.data.scale;
Expand Down Expand Up @@ -713,6 +713,14 @@ export class CanvasModelImpl extends MasterImpl implements CanvasModel {
// scale is changed during zooming or translating
// so, remember fitted scale to compute fit-relative scaling
this.data.fittedScale = this.data.scale;
return true;
}

return false;
}

public fit(): void {
if (this.resetScale()) {
this.notify(UpdateReasons.IMAGE_FITTED);
}
}
Expand Down

0 comments on commit 163b64d

Please sign in to comment.