From: Ian Jackson Date: Wed, 14 Apr 2021 00:39:52 +0000 (+0100) Subject: js: cancel special selection which clicking on background, etc. X-Git-Tag: otter-0.5.0~75 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=28db1600b0110a557f13e08d8d551931d88399b6;p=otter.git js: cancel special selection which clicking on background, etc. Signed-off-by: Ian Jackson --- 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;