Camera now centers on focusable zone properly

This commit is contained in:
Hanusiak Piotr
2022-01-13 18:54:38 +01:00
parent a164cedf3f
commit c2b2385e96
6 changed files with 97 additions and 42 deletions
+6 -1
View File
@@ -840,7 +840,12 @@ export class GameScene extends DirtyScene {
if (focusable && focusable.value === true) {
const zoomMargin = zone.properties?.find((property) => property.name === "zoom_margin");
this.cameraManager.enterFocusMode(
zone,
{
x: zone.x + zone.width * 0.5,
y: zone.y + zone.height * 0.5,
width: zone.width,
height: zone.height,
},
zoomMargin ? Math.max(0, Number(zoomMargin.value)) : undefined
);
break;