change setViewport action to set for CameraAPI

This commit is contained in:
Hanusiak Piotr 2022-01-14 11:41:37 +01:00
parent 17e9c3c586
commit 7ee41bad30
7 changed files with 24 additions and 20 deletions

View file

@ -140,6 +140,10 @@ export class CameraManager extends Phaser.Events.EventEmitter {
}
this.camera.pan(focusOn.x, focusOn.y, duration, Easing.SineEaseOut, true, (camera, progress, x, y) => {
this.waScaleManager.zoomModifier = currentZoomModifier + progress * zoomModifierChange;
if (progress === 1) {
// NOTE: Making sure the last action will be centering after zoom change
this.camera.centerOn(focusOn.x, focusOn.y);
}
this.emit(CameraManagerEvent.CameraUpdate, this.getCameraUpdateEventData());
});
}