FEATURE: add the ability to zoom in and out using touch screen
This commit is contained in:
parent
71898bff7d
commit
d7a74baa9d
11 changed files with 77 additions and 10 deletions
16
front/src/Phaser/UserInput/PinchManager.ts
Normal file
16
front/src/Phaser/UserInput/PinchManager.ts
Normal 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;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue