FEATURE: add the ability to zoom in and out using touch screen

This commit is contained in:
kharhamel 2021-04-14 17:47:26 +02:00
parent 71898bff7d
commit d7a74baa9d
11 changed files with 77 additions and 10 deletions

View file

@ -0,0 +1,16 @@
import {Pinch} from "phaser3-rex-plugins/plugins/gestures.js";
export class PinchManager {
private scene: Phaser.Scene;
private pinch!: any;
constructor(scene: Phaser.Scene) {
this.scene = scene;
this.pinch = new Pinch(scene);
this.pinch.on('pinch', (pinch:any) => {
this.scene.cameras.main.zoom *= pinch.scaleFactor;
});
}
}