2021-04-14 17:47:26 +02:00
|
|
|
import {Pinch} from "phaser3-rex-plugins/plugins/gestures.js";
|
2021-05-04 11:29:37 +02:00
|
|
|
import {waScaleManager} from "../Services/WaScaleManager";
|
2021-04-14 17:47:26 +02:00
|
|
|
|
|
|
|
export class PinchManager {
|
|
|
|
private scene: Phaser.Scene;
|
2021-04-16 18:49:04 +02:00
|
|
|
private pinch!: any; // eslint-disable-line
|
2021-05-04 11:29:37 +02:00
|
|
|
|
2021-04-14 17:47:26 +02:00
|
|
|
constructor(scene: Phaser.Scene) {
|
|
|
|
this.scene = scene;
|
|
|
|
this.pinch = new Pinch(scene);
|
|
|
|
|
2021-04-16 18:49:04 +02:00
|
|
|
this.pinch.on('pinch', (pinch:any) => { // eslint-disable-line
|
2021-05-04 11:29:37 +02:00
|
|
|
waScaleManager.zoomModifier *= pinch.scaleFactor;
|
2021-04-14 17:47:26 +02:00
|
|
|
});
|
|
|
|
}
|
2021-05-04 11:29:37 +02:00
|
|
|
|
|
|
|
destroy() {
|
|
|
|
this.pinch.removeAllListeners();
|
|
|
|
}
|
|
|
|
}
|