locking zooming via player input
This commit is contained in:
parent
85bf2fe70d
commit
d0cd7b0806
@ -28,7 +28,11 @@ export class CameraManager extends Phaser.Events.EventEmitter {
|
||||
return this.camera;
|
||||
}
|
||||
|
||||
public changeCameraFocus(focusOn: { x: number, y: number, width: number, height: number }, duration: number = 1000): void {
|
||||
public changeCameraFocus(
|
||||
focusOn: { x: number, y: number, width: number, height: number }, duration: number = 1000,
|
||||
): void {
|
||||
this.waScaleManager.saveZoom();
|
||||
this.waScaleManager.lockZoomingViaPlayerInput();
|
||||
const maxZoomModifier = 2.84; // How to get max zoom value?
|
||||
const currentZoomModifier = this.waScaleManager.zoomModifier;
|
||||
const zoomModifierChange = maxZoomModifier - currentZoomModifier;
|
||||
@ -43,6 +47,8 @@ export class CameraManager extends Phaser.Events.EventEmitter {
|
||||
}
|
||||
|
||||
public startFollow(target: object | Phaser.GameObjects.GameObject): void {
|
||||
this.waScaleManager.lockZoomingViaPlayerInput(false);
|
||||
this.waScaleManager.restoreZoom();
|
||||
this.camera.startFollow(target, true);
|
||||
}
|
||||
|
||||
|
@ -1954,6 +1954,9 @@ ${escapedMessage}
|
||||
}
|
||||
|
||||
zoomByFactor(zoomFactor: number) {
|
||||
if (waScaleManager.isZoomingViaPlayerInputLocked()) {
|
||||
return;
|
||||
}
|
||||
waScaleManager.zoomModifier *= zoomFactor;
|
||||
biggestAvailableAreaStore.recompute();
|
||||
}
|
||||
|
@ -12,6 +12,8 @@ export class WaScaleManager {
|
||||
private actualZoom: number = 1;
|
||||
private _saveZoom: number = 1;
|
||||
|
||||
private zoomingViaPlayerInputLocked: boolean = false;
|
||||
|
||||
public constructor(private minGamePixelsNumber: number, private absoluteMinPixelNumber: number) {
|
||||
this.hdpiManager = new HdpiManager(minGamePixelsNumber, absoluteMinPixelNumber);
|
||||
}
|
||||
@ -21,6 +23,14 @@ export class WaScaleManager {
|
||||
this.game = game;
|
||||
}
|
||||
|
||||
public isZoomingViaPlayerInputLocked(): boolean {
|
||||
return this.zoomingViaPlayerInputLocked;
|
||||
}
|
||||
|
||||
public lockZoomingViaPlayerInput(lock: boolean = true): void {
|
||||
this.zoomingViaPlayerInputLocked = lock;
|
||||
}
|
||||
|
||||
public applyNewSize() {
|
||||
const { width, height } = coWebsiteManager.getGameSize();
|
||||
|
||||
|
@ -172,14 +172,14 @@
|
||||
"y":96
|
||||
},
|
||||
{
|
||||
"height":64,
|
||||
"height":352,
|
||||
"id":11,
|
||||
"name":"coffeeZone",
|
||||
"name":"meetingZone",
|
||||
"properties":[
|
||||
{
|
||||
"name":"display_name",
|
||||
"type":"string",
|
||||
"value":"Coffee Time!"
|
||||
"value":"Brainstorm Zone!"
|
||||
},
|
||||
{
|
||||
"name":"focusable",
|
||||
@ -189,9 +189,9 @@
|
||||
"rotation":0,
|
||||
"type":"zone",
|
||||
"visible":true,
|
||||
"width":64,
|
||||
"x":64,
|
||||
"y":288
|
||||
"width":224,
|
||||
"x":736,
|
||||
"y":96
|
||||
}],
|
||||
"opacity":1,
|
||||
"type":"objectgroup",
|
||||
|
Loading…
Reference in New Issue
Block a user