From: Ian Jackson Date: Tue, 13 Apr 2021 22:24:53 +0000 (+0100) Subject: js: Sort out allow_for_deselect X-Git-Tag: otter-0.5.0~90 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=9177d8b73b10f2f4c5202cebfb79ae69f15b2bee;p=otter.git js: Sort out allow_for_deselect Signed-off-by: Ian Jackson --- diff --git a/templates/script.ts b/templates/script.ts index 35aebfb4..fd309091 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -896,9 +896,11 @@ function mouse_find_predicate( continue; } if (p.pinned) pinned = true; + if (i == 0) { held = p.held; - } else if (allow_for_deselect && held == us) { + if (held == us && !allow_for_deselect) held = null; + } else if (held == us) { // user is going to be deselecting if (p.held != us) { // skip ones we don't have @@ -909,8 +911,10 @@ function mouse_find_predicate( if (p.held == us) { is_already(); continue; // skip ones we have already + } else if (p.held == null) { + } else { + held = p.held; // wrestish } - if (held == null) held = p.held; // wrestish } clicked.push(piece); } @@ -1003,10 +1007,13 @@ function drag_mousedown(e : MouseEvent, shifted: boolean) { return; } dragging = DRAGGING.MAYBE_GRAB; - for (let i=0; i