Fix #10297: dispatch canvas.zoom event on double-click annotation zoom#10403
Open
DanielBorgs wants to merge 1 commit intocvat-ai:developfrom
Open
Fix #10297: dispatch canvas.zoom event on double-click annotation zoom#10403DanielBorgs wants to merge 1 commit intocvat-ai:developfrom
DanielBorgs wants to merge 1 commit intocvat-ai:developfrom
Conversation
249b171 to
0f8a8a6
Compare
When zooming into an annotation via double-click, the onFocusRegion method in canvasView.ts was not dispatching the 'canvas.zoom' custom event. This caused the UI to skip the font-size recalculation for issue labels, making them scale up with the canvas transform instead of staying at a fixed size. Scroll wheel zoom already dispatched 'canvas.zoom' correctly, which is why the bug was only reproducible with double-click zoom. The fix dispatches 'canvas.zoom' at the end of onFocusRegion, in the same way it is dispatched in the scroll wheel zoom handler.
0f8a8a6 to
a2ea02c
Compare
Author
|
Hi @bsekachev, @nmanovic, just pinging on this for a review when you have a chance! Let me know if you need any adjustments. Also, the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and context
Fixes #10297
When zooming into an annotation via double-click, issue labels shown in review mode would incorrectly scale up with the canvas transform. This happened because the onFocusRegion method in canvasView.ts was not dispatching the canvas.zoom custom event after zooming, unlike the scroll wheel zoom handler which already dispatched it correctly.
The canvas.zoom event is used by the UI to recalculate and counteract the CSS transform applied to issue labels, keeping their font size constant regardless of zoom level. Since onFocusRegion never fired this event, the labels would scale up visually when using double-click zoom.
The fix dispatches canvas.zoom at the end of onFocusRegion, matching the existing behavior of the scroll wheel zoom handler.
How has this been tested?
Manual testing:
Created a task, opened a job in review mode, created an issue on an annotation, and verified that double-click zooming no longer scales up the issue label text.
Automated testing:
Added a Cypress e2e test in tests/cypress/e2e/issues_prs2/issue_10297_zooming_in_onto_annotation_increases_issue_text_size.js that patches EventTarget.prototype.dispatchEvent and asserts that a canvas.zoom event is fired when double-clicking an annotation shape.
Checklist
developbranch[ ] I have updated the documentation accordinglyLicense
Feel free to contact the maintainers if that's a concern.