From 3907a04584ebf2ad5e9df9b35ccb86577d55c2e7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 18 Apr 2022 10:18:00 +0100 Subject: [PATCH] Add "p" argument to mouse_clicked_one Almost the callers have it and the one that doesn't (mouse_find_clicked) is about to need it in another of its branches. Signed-off-by: Ian Jackson --- templates/script.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/script.ts b/templates/script.ts index c24ef095..ab7b2ab6 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -993,8 +993,7 @@ function ungrab_clicked(clicked: PieceId[]) { do_ungrab_n(todo); } -function mouse_clicked_one(piece: PieceId): MouseFindClicked { - let p = pieces[piece]!; +function mouse_clicked_one(piece: PieceId, p: PieceInfo): MouseFindClicked { let held = p.held; let pinned = p.pinned; return { clicked: [piece], held, pinned }; @@ -1077,7 +1076,7 @@ function mouse_find_lowest(e: MouseEvent) { let piece = uelem.dataset.piece!; let p = pieces[piece]!; if (p_bbox_contains(p, clickpos)) { - return mouse_clicked_one(piece); + return mouse_clicked_one(piece, p); } } return null; @@ -1089,8 +1088,9 @@ function mouse_find_clicked(e: MouseEvent, note_already: PieceSet | null, ): MouseFindClicked { + let p = pieces[piece]!; if (special_count == null) { - return mouse_clicked_one(piece); + return mouse_clicked_one(piece, p); } else if (special_count == 0) { return mouse_find_lowest(e); } else { // special_count > 0 -- 2.30.2