From dd5422bce68dae3fe03656733a55c415d94b6e16 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 13 Apr 2021 20:23:43 +0100 Subject: [PATCH] js: Allow special select of pinned things in in wresting mode We are going to reuse this code for drag select. Might as well let this work, although it is a bit exciting and I think right now you can't be in wresting mode and also special select. Signed-off-by: Ian Jackson --- templates/script.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/script.ts b/templates/script.ts index 64c77fa0..890566a4 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -853,7 +853,7 @@ function mouse_find_predicate( ): MouseFindClicked { let clicked: PieceId[]; let held; - let pinned; + let pinned = false; clicked = []; let uelem = defs_marker; @@ -866,18 +866,18 @@ function mouse_find_predicate( } let piece = uelem.dataset.piece!; let p = pieces[piece]; + if (p.pinned && !wresting) continue; if (!predicate(p)) { continue; } + if (p.pinned) pinned = true; if (i > 0) { - if (p.pinned != pinned || - p.held != held) { - add_log_message(`Mixed pinned/held states! Stopped after ${i}`); + if (p.held != held) { + add_log_message(`Mixed held states! Stopped after ${i}`); return null; } } clicked.push(piece); - pinned = p.pinned; held = p.held; } if (clicked.length == 0) return null; -- 2.30.2