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

Fix issue scaling on image filter appication #9126

Merged
merged 5 commits into from
Feb 25, 2025
Merged
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
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
Loading