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

Do not reset zoom when switching between workspaces #9233

Merged
merged 5 commits into from
Mar 31, 2025

Conversation

klakhov
Copy link
Contributor

@klakhov klakhov commented Mar 20, 2025

Motivation and context

An improvement requested by the data annotation team: switching between workspaces (standard and review) caused the zoom level to reset, which was not user-friendly. This PR addresses the issue.

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 Mar 20, 2025
@klakhov klakhov requested a review from bsekachev as a code owner March 20, 2025 08:47
@klakhov klakhov changed the title removed run of resize event on first render of canvas layout Do not reset zoom when switching between workspaces Mar 21, 2025
@codecov-commenter
Copy link

codecov-commenter commented Mar 21, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.17%. Comparing base (21db1d4) to head (dfaff4e).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #9233   +/-   ##
========================================
  Coverage    74.16%   74.17%           
========================================
  Files          428      428           
  Lines        44964    44971    +7     
  Branches      3918     3919    +1     
========================================
+ Hits         33348    33356    +8     
+ Misses       11616    11615    -1     
Components Coverage Δ
cvat-ui 77.22% <85.71%> (+0.01%) ⬆️
cvat-server 71.63% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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 as fix

However I would propose to get rid of triggering resize event on windows as potentially it may lead to unnecessary layout changes in other UI elements.

My idea here is to wrap onResize with useCallback depending on fitCanvas.
And wrap setLayoutConfig calling this callback in zero setTimeout after setting the state. Not sure about if we really need setTimeout. As this is not related directly to this PR is up to you to implement or not.

@klakhov klakhov merged commit 77dc26f into develop Mar 31, 2025
34 checks passed
@klakhov klakhov deleted the kl/remove-zoom-reset branch March 31, 2025 14:04
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