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

Fix issue scaling on image filter appication #9126

merged 5 commits into from
Feb 25, 2025

Conversation

klakhov
Copy link
Contributor

@klakhov klakhov commented Feb 20, 2025

Motivation and context

Currently we have such a problem:
issue-scale1

The issue occurs when applying an image filter. The bug follows these steps:

  1. Enabling an image filter triggers canvasInstance.setup().
  2. Inside canvasModel.setup() after getting frameData.data(), canvas.fit() is called (likely to maintain zoom and position even when switching to an image with a different resolution).
  3. canvas.fit() dispatches a canvas.fit event, which the issues component listens to. As a result, the issues component receives the default zoom, causing issue elements to appear larger than expected.

To fix this, I extracted the scale reset into a separate method. There's no need to dispatch the fit event inside canvasModel.setup(), as inside of it we need to reset the scale to base parameters before adjusting it with relativeScaling

How has this been tested?

Checklist

  • I submit my changes into the develop branch
  • I have created a changelog fragment
  • [ ] I have updated the documentation accordingly
  • [ ] I have added tests to cover my changes
  • [ ] I have linked related issues (see GitHub docs)

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.

@klakhov klakhov added the ui/ux label Feb 20, 2025
@klakhov klakhov requested a review from bsekachev as a code owner February 20, 2025 08:32
@codecov-commenter
Copy link

codecov-commenter commented Feb 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.16%. Comparing base (de42098) to head (4a03c02).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9126      +/-   ##
===========================================
- Coverage    73.18%   73.16%   -0.02%     
===========================================
  Files          446      446              
  Lines        45661    45665       +4     
  Branches      3907     3908       +1     
===========================================
- Hits         33418    33412       -6     
- Misses       12243    12253      +10     
Components Coverage Δ
cvat-ui 77.04% <100.00%> (-0.05%) ⬇️
cvat-server 70.04% <ø> (ø)

@bsekachev
Copy link
Member

PR description is not really clear, as canvas.configure does not actually call canvas.fit

@klakhov
Copy link
Contributor Author

klakhov commented Feb 24, 2025

Updated description added some links to code. My bad, it was not a .configure() but .setup() method I was talking about

@klakhov klakhov requested a review from nmanovic as a code owner February 24, 2025 07:37
Copy link
Member

@bsekachev bsekachev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@klakhov klakhov merged commit 163b64d into develop Feb 25, 2025
34 checks passed
@cvat-bot cvat-bot bot mentioned this pull request Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants