-
Notifications
You must be signed in to change notification settings - Fork 384
Fix zoom tool aspect ratio #2055
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
base: main
Are you sure you want to change the base?
Fix zoom tool aspect ratio #2055
Conversation
…as heght even for image with greater width
Can you check if does also fix #1963 ? |
@daker Hi, sorry for the late reply. The reason this PR is still in draft is that, when zooming out, it does not account for the padding around the image. In the default behavior, the displayArea looks like this: If you can guide me on how to find and implement the padding handling in this logic, I’d be happy to help. And we can talk about in slack Kanthakumar K |
@daker I figured out how get the display area so that sorted but the Issue #1963 it sort of fixed because i don't why but the values are slightly off. |
@sedghi can you check this because we need this in our project |
let thresholdExceeded = false; | ||
// Get display area, if available | ||
const displayArea = viewport.options?.displayArea; | ||
const imageAreaScaleX = displayArea?.imageArea?.[0] ?? 1.1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this magic number 1.1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is not a magic number it is the default padding set to image area
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context
When a minScale is set to ZoomTool the image with greater height works fine but image with greater width stop zooming out when the image height reaches the height of the canvas
Changes & Results
Both had the same configuration:

Before:
zoom-before.mp4
After:
zoom-after.mp4
Testing
Checklist
PR
fix(CobbAngleTool - touch): Add touch event listeners for CobbAngleTool
semantic-release format and guidelines.
Code
etc.)
Public Documentation Updates
additions or removals.
Tested Environment