hammerjs / hammer.js

A javascript library for multi-touch gestures :// You can touch this
http://hammerjs.github.io
MIT License
24.14k stars 2.62k forks source link

Pinch & Rotate without Pan? #1055

Open YarGnawh opened 7 years ago

YarGnawh commented 7 years ago

Is it possible to pinch and rotate without the pan recognizer? The pan recognizer makes the page unscrollable on iOS. I tried a few things:

  1. Setting a min pointer count of 2 on the pan recognizer (no good)
  2. Toggling the pan gesture on after the rotate / pinch recognizer fires (no good)
  3. Unable to "bubble" the pan event to the page

Any thoughts?

alsatian commented 6 years ago

disabling pan while pinching worked for me with a little delay before reenabling pan

var timeout;
mc.on("pinchstart", function(ev) {
    mc.get('pan').set({
        enable: false
    });
    clearTimeout(timeout)
});
mc.on("pinchend", function(ev) {
    timeout = setTimeout(function() {
        mc.get('pan').set({
            enable: true
        });
    }, 250);
});