From 0560b73b17fd91d965244d7a4627af5c22a6a507 Mon Sep 17 00:00:00 2001 From: Amy Date: Mon, 11 Dec 2023 13:37:42 +0200 Subject: [PATCH] [fix] cooks positions on reload --- src/types/canvasCook.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/types/canvasCook.ts b/src/types/canvasCook.ts index 284f1e9..a876189 100644 --- a/src/types/canvasCook.ts +++ b/src/types/canvasCook.ts @@ -63,8 +63,18 @@ export class CanvasCook { this.currentStage = currentStage; const [x, y, dx, dy] = COOK_POSITIONS[currentStage]; - this.targetX = x + dx * stageCooksCount * 50; - this.targetY = y + dy * stageCooksCount * 50; + if (stageCooksCount > 6) { + if (stageCooksCount > 11) { + [this.targetX, this.targetY] = [x, y]; + } else { + [this.targetX, this.targetY] = [ + x + (25 * dx) + dx * (stageCooksCount - 6) * 50, + y + (25 * dy) + dy * (stageCooksCount - 6) * 50 + ]; + } + } else { + [this.targetX, this.targetY] = [x + dx * stageCooksCount * 50, y + dy * stageCooksCount * 50]; + } this.moving = false;