From d898d24de5089a5d9abb68390f2ce92488fdf704 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 19 Jun 2022 20:16:51 +0100 Subject: [PATCH] script: Break out pinned_log_message We're going to reuse this. Signed-off-by: Ian Jackson --- templates/script.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/script.ts b/templates/script.ts index 8760224d..2de8a0bd 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -303,6 +303,9 @@ function piece_moveable(p: PieceInfo) { function treat_as_pinned(p: { pinned: boolean }): boolean { return p.pinned && !wresting; } +function pinned_log_message(p: PieceInfo) { + add_log_message('That piece ('+p.desc+') is pinned to the table.'); +} // ----- key handling ----- @@ -1215,8 +1218,7 @@ function drag_mousedown(e : MouseEvent, shifted: boolean) { ungrab_all_except(note_already); } if (treat_as_pinned(c)) { - let p = pieces[c.clicked[0]!]!; - add_log_message('That piece ('+p.desc+') is pinned to the table.'); + pinned_log_message(pieces[c.clicked[0]!]!); return; } grab_clicked(clicked, !wresting, multigrab); -- 2.30.2