pentool icon indicating copy to clipboard operation
pentool copied to clipboard

Pinch-zoom / Pinch-rotate for Safari (& Mobile)

Open Martin-Pitt opened this issue 5 years ago • 0 comments

Issue #3 reminded me of my codepen, which I recently updated to include Safari gestures. Which means support for Safari desktop browser and Safari Mobile on iOS.

See: https://codepen.io/nexii/pen/mzyLYJ

There is:

document.addEventListener('gesturestart', onGesture);
document.addEventListener('gesturechange', onGesture);
document.addEventListener('gestureend', onGesture);

You can use event.scale and event.rotation. If I remember correctly:

  • Scale 1.0 is based on gesturestart, this is a uniform multiplier
  • Rotation 0.0 is based on gesturestart and the value is in degrees

Official documentation is available at: https://developer.apple.com/documentation/webkitjs/gestureevent

Martin-Pitt avatar Oct 04 '18 16:10 Martin-Pitt