pentool
pentool copied to clipboard
Pinch-zoom / Pinch-rotate for Safari (& Mobile)
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