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

Fix console error when zoom avatar with keyboard #27734

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/components/ImageView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,15 @@ function ImageView({isAuthTokenRequired, url, fileName}) {
*/
const onContainerPress = (e) => {
if (!isZoomed && !isDragging) {
const {offsetX, offsetY} = e.nativeEvent;
// Dividing clicked positions by the zoom scale to get coordinates
// so that once we zoom we will scroll to the clicked location.
const delta = getScrollOffset(offsetX / zoomScale, offsetY / zoomScale);
setZoomDelta(delta);
if (e.nativeEvent) {
const {offsetX, offsetY} = e.nativeEvent;
// Dividing clicked positions by the zoom scale to get coordinates
pecanoro marked this conversation as resolved.
Show resolved Hide resolved
// so that once we zoom we will scroll to the clicked location.
const delta = getScrollOffset(offsetX / zoomScale, offsetY / zoomScale);
setZoomDelta(delta);
} else {
setZoomDelta({offsetX: 0, offsetY: 0});
}
}

if (isZoomed && isDragging && isMouseDown) {
Expand Down
Loading