Skip to content

Commit

Permalink
fix(zoom): fix issue when slide change possible during zoom out
Browse files Browse the repository at this point in the history
  • Loading branch information
nolimits4web committed May 22, 2024
1 parent fc8ed1a commit f67308c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/modules/zoom/zoom.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
let isScaling = false;
let fakeGestureTouched;
let fakeGestureMoved;
let preventZoomOut;
const evCache = [];
const gesture = {
originX: 0,
Expand Down Expand Up @@ -270,7 +271,6 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
if (!image.isTouched || !gesture.slideEl) {
return;
}

if (!image.isMoved) {
image.width = gesture.imageEl.offsetWidth || gesture.imageEl.clientWidth;
image.height = gesture.imageEl.offsetHeight || gesture.imageEl.clientHeight;
Expand All @@ -284,11 +284,6 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
const scaledWidth = image.width * zoom.scale;
const scaledHeight = image.height * zoom.scale;

if (scaledWidth < gesture.slideWidth && scaledHeight < gesture.slideHeight) {
allowTouchMove();
return;
}

image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0);
image.maxX = -image.minX;
image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0);
Expand Down

0 comments on commit f67308c

Please sign in to comment.