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

Glitchy zoom and pan on mobile devices #32

Open
davwheat opened this issue Nov 10, 2019 · 5 comments
Open

Glitchy zoom and pan on mobile devices #32

davwheat opened this issue Nov 10, 2019 · 5 comments

Comments

@davwheat
Copy link

davwheat commented Nov 10, 2019

Video attached.

Panning often scrolls up and down the page instead of panning.

Zooming is very laggy, random or doesn't work at all.

https://puu.sh/ED3Ps/d38a0c1a8d.mp4

@n1ru4l
Copy link
Contributor

n1ru4l commented Nov 11, 2019

Even worse in iPhone devices.

You will have to hijack the touch events:

if (/iPad|iPhone|iPod/.test(navigator.userAgent)) {
  window.addEventListener(
    "touchstart",
    ev => {
      ev.preventDefault();
    },
    { passive: false }
  );
}

@davwheat
Copy link
Author

The only issue is that it doesn't solve the issue.

It just prevents scrolling the whole page!

@davwheat
Copy link
Author

davwheat commented Nov 11, 2019

I mainly solved this by adding a class to the <PanZoom ... /> element with these styles. This has prevented scrolling and significantly improved performance! I would highly recommend including info about this in the documentation.

.panZoom,
.panZoom * {
  touch-action: none;
}

@mnogueron
Copy link
Owner

@davwheat since now I haven't focused that much on the mobile side of this library. What you are saying is relevant and will consider including it in a new version.

@n1ru4l
Copy link
Contributor

n1ru4l commented Nov 12, 2019

The only issue is that it doesn't solve the issue.

It just prevents scrolling the whole page!

You have to only apply it when scrolling is in progress (for iOS)... 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants