From d9c95b79832fff59acc7cd2bea3f6b4a01baec82 Mon Sep 17 00:00:00 2001 From: Rien Heuver Date: Mon, 23 Oct 2023 15:56:01 +0200 Subject: [PATCH] feat: add home smoothing --- lib/classes/GroupingApplication.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/classes/GroupingApplication.ts b/lib/classes/GroupingApplication.ts index f592484..db8f94c 100644 --- a/lib/classes/GroupingApplication.ts +++ b/lib/classes/GroupingApplication.ts @@ -60,6 +60,11 @@ export class GroupingApplication extends Application { this.viewport.on("rightdown", this.rightclick, this); this.stage.addChild(this.viewport); + + window.addEventListener("load", () => { + this.resizeCanvas(this.screen.width, this.screen.height); + this.viewport.moveCenter(0, 0); + }); } public addBlocks(blocks: Block[]) { @@ -113,7 +118,11 @@ export class GroupingApplication extends Application { } public panToHome(): void { - this.viewport.moveCenter(0, 0); + this.viewport.animate({ + removeOnInterrupt: true, + position: { x: 0, y: 0 }, + time: 500, + }); } public getLocations(): Point[] {