Save zoom level of the game and restore it when quitting the login scenes

SelectCompanionScene with zoom on mobile
This commit is contained in:
GRL 2021-06-02 16:08:31 +02:00
parent 6fd119c199
commit 3d9e2ad49a
6 changed files with 40 additions and 14 deletions

View file

@ -10,6 +10,7 @@ class WaScaleManager {
private scaleManager!: ScaleManager;
private game!: Game;
private actualZoom: number = 1;
private _saveZoom: number = 1;
public constructor(private minGamePixelsNumber: number, private absoluteMinPixelNumber: number) {
this.hdpiManager = new HdpiManager(minGamePixelsNumber, absoluteMinPixelNumber);
@ -57,6 +58,15 @@ class WaScaleManager {
this.applyNewSize();
}
public saveZoom(): void {
this._saveZoom = this.hdpiManager.zoomModifier;
}
public restoreZoom(): void{
this.hdpiManager.zoomModifier = this._saveZoom;
this.applyNewSize();
}
/**
* This is used to scale back the ui components to counter-act the zoom.
*/