Skip to content

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

@Martin-Pitt

Description

@Martin-Pitt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions