Bottom-left coordinates of the matrix after zoom #2518
Unanswered
drormekorot
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using SkiaSharp in Xamarin to display an image and have implemented the functionality to zoom and pan.
Zoom and pan work great, and I want to stop the panning when the user reaches the image's boundaries.
I'm currently using
Matrix.TransX
andMatrix.TransY
to get the coordinates of the top-left corner in the zoomed image, however this only allows me to correctly stop the movement when it is to the left and upwards. WhenTransX
andTransY
reach 0, I stop the movement.When I try to stop the movement when it is to the right and downwards, the movement only stops when the top-left corner of the zoomed matrix is on top of the bottom-right corner of the original image
The issue is, I cannot find the correct way to calculate the bottom-left coordinates of the zoomed matrix.
I've taken the sizes of the zoomed matrix manually and got a linear function, but there are many image sizes and it will only work on that specific size.
For example, an image 1912 pixels on the X axis provide the following values of the zoomed matrix X axis for the following scales (I allow scales 1-6):
Scale Pixels
1.37 1906
1.59 1841
1.86 1811
4.52 1417
6.00 1127
How can I calculate the bottom-left coordinates of the zoomed matrix for all image sizes?
Beta Was this translation helpful? Give feedback.
All reactions