-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix image zoom issues on mobile #27285
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
Conversation
| }, []) | ||
|
|
||
| // in order for the images to not get downscaled we have to make it larger and then transform it | ||
| const manualScale = 5 |
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.
i think we can skip this
|
|
||
| const translationX = useSharedValue(0) | ||
| const translationY = useSharedValue(0) | ||
| const velocityX = useSharedValue(0) |
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.
let it fling like ios a bit
| .onStart(() => { | ||
| if (isPinching.value || !isZoomed.value) return | ||
|
|
||
| .averageTouches(true) |
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.
we want the center of touches and not jump around depending on how fingers go up / down
| .onUpdate(e => { | ||
| if (isPinching.value || !isZoomed.value) { | ||
| // if we're done panning ignore us letting go | ||
| if (e.numberOfPointers < panFingers.value) { |
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.
this is so when you transition from a pinch to just fingers we don't pan around after, its too jarring
| panTranslateX.value = e.translationX | ||
| panTranslateY.value = e.translationY | ||
| } else { | ||
| // imagine what happens to pixels when we zoom in. (they get multiplied by x times scale) |
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.
we don't need this logic
Uh oh!
There was an error while loading. Please reload this page.