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: Ensure the Zoom module's array is cleared onTouchEnd #7830

Merged
Merged
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/modules/zoom/zoom.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
let isScaling = false;
let fakeGestureTouched;
let fakeGestureMoved;
let preventZoomOut;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 this was simply unused.

const evCache = [];
const gesture = {
originX: 0,
Expand Down Expand Up @@ -378,6 +377,7 @@ export default function Zoom({ swiper, extendParams, on, emit }) {
}
function onTouchEnd() {
const zoom = swiper.zoom;
evCache.length = 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Chrome for iOS, long pressing a slide's image would leave the previous touch event in the evCache array.
This ensure that evCache is cleared onTouchEnd.

if (!gesture.imageEl) return;
if (!image.isTouched || !image.isMoved) {
image.isTouched = false;
Expand Down
Loading