From 28db1600b0110a557f13e08d8d551931d88399b6 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 14 Apr 2021 01:39:52 +0100 Subject: [PATCH] js: cancel special selection which clicking on background, etc. Signed-off-by: Ian Jackson --- templates/script.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/templates/script.ts b/templates/script.ts index 2dfc468c..f1f8e0d0 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -1276,6 +1276,13 @@ function rectsel_mouseup(e: MouseEvent) { rectsel_path.firstElementChild!.setAttributeNS(null,'d',''); let pos2 = rectsel_nontrivial_pos2(e); + if (pos2 == null) { + // clicked not on a piece, and didn't drag + special_count = null; + special_count_reupdate(); + // we'll bail in a moment, after possibly unselecting things + } + let note_already = Object.create(null); let c = null; @@ -1317,6 +1324,10 @@ function rectsel_mouseup(e: MouseEvent) { return; } + // did the special + special_count = null; + special_count_reupdate(); + if (rectsel_shifted && c.held == us) { ungrab_clicked(c.clicked); return; -- 2.30.2