From ef4232d04ed11e93e54c84e7bd8689a3d6f3d528 Mon Sep 17 00:00:00 2001 From: Showdown76py Date: Tue, 17 Nov 2026 13:40:28 +0100 Subject: [PATCH] Vote page: auto zoom looks closer at the middle when no ring shows up at all (back rows) --- static/js/vote.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/static/js/vote.js b/static/js/vote.js index 5ddc23b..20f8d3f 100644 --- a/static/js/vote.js +++ b/static/js/vote.js @@ -182,12 +182,14 @@ function makeScanner(video, onToken, onOther) { // ~40 % of the frame, never so far that it would leave the frame. a code filling the frame zooms back out, // and losing it for a while goes back to the widest view function newZoomState(base, max) { - return { base, max, now: base, auto: true, lastRead: 0, lastSeen: 0, lastMove: 0 }; + const t = performance.now(); + return { base, max, now: base, auto: true, lastRead: 0, lastSeen: t, lastMove: t }; } function zoomPlan(zs, d, now) { if (d.token) zs.lastRead = now; - const w = d.where, seen = !!w && (d.score ?? 0) >= 0.55; + // a zoom too many costs nothing, so a weak sync ring is enough to steer on + const w = d.where, seen = !!w && (d.score ?? 0) >= 0.4; if (seen) zs.lastSeen = now; if (now - zs.lastMove < 900) return null; let z = null; @@ -201,6 +203,11 @@ function zoomPlan(zs, d, now) { } else if (!seen && now - zs.lastSeen > 2500 && zs.now > zs.base) { z = zs.base; zs.lastSeen = now; + } else if (!seen && zs.now === zs.base && now - zs.lastSeen > 1500 && now - zs.lastMove > 1500) { + // from the back rows the ring is too small to be found at all: look closer where the person aims, the + // middle, and fall back to wide again (branch above) when nothing shows up there either + z = Math.min(zs.max, zs.base * 2); + zs.lastSeen = now; } if (z != null) zs.lastMove = now; return z;