From: Ian Jackson Date: Tue, 13 Apr 2021 19:23:43 +0000 (+0100) Subject: js: Allow special select of pinned things in in wresting mode X-Git-Tag: otter-0.5.0~98 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=dd5422bce68dae3fe03656733a55c415d94b6e16;p=otter.git 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 --- 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;