Skip to content

Commit

Permalink
fix(zoom): fix zoomIn after currentScale is set to 1 (#7663)
Browse files Browse the repository at this point in the history
* Fix zoomIn after currentScale is set to 1

* Update zoom.mjs

---------

Co-authored-by: Vladimir Kharlampidi <nolimits4web@gmail.com>
  • Loading branch information
dkacperski97 and nolimits4web committed Aug 21, 2024
1 parent 39cd7f5 commit 94173da
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/modules/zoom/zoom.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
if (currentScale === 1 && forceZoomRatio) {
touchX = undefined;
touchY = undefined;
image.touchesStart.x = undefined;
image.touchesStart.y = undefined;
}

const maxRatio = getMaxRatio();
Expand Down Expand Up @@ -584,6 +586,8 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
}
zoom.scale = 1;
currentScale = 1;
image.touchesStart.x = undefined;
image.touchesStart.y = undefined;
gesture.imageWrapEl.style.transitionDuration = '300ms';
gesture.imageWrapEl.style.transform = 'translate3d(0,0,0)';
gesture.imageEl.style.transitionDuration = '300ms';
Expand Down

0 comments on commit 94173da

Please sign in to comment.