A plugin for pixi-viewport allowing pinch-to-zoom behavior with the non-standard GestureEvent API. Though this isn't on a standards track, it's necessary to support pinch to zoom behavior on certain browsers (Safari).
import { Viewport } from 'pixi-viewport';
import GesturePinch from 'pixi-viewport-gesture-pinch';
const viewport = new Viewport(options);
viewport.pinch();
const gesturePinch = new GesturePinch({ viewport });
viewport.plugins.add('gesture-pinch', gesturePinch);If you're developing locally, you may want to npm link this module into your
project:
$ npm link --only=production /path/to/pixi-viewport-gesture-pinchIf you're using TypeScript, due to issues with module resolution for npm linked type definitions you'll need to make sure your build system preserves
symlinks. In Webpack, set resolve.symlinks to false. In a tsconfig file,
set compilerOptions.preserveSymlinks to true