Vote screen: ring keeps the wider column and title shares a line with the entry qr; camera zoom button where the phone supports it

This commit is contained in:
2026-11-17 12:08:25 +01:00
parent fbc12f84d9
commit 3efb80b802
3 changed files with 33 additions and 13 deletions
+10 -9
View File
@@ -38,17 +38,18 @@ body.screen {
font-weight: 700; font-size: .8em; font-weight: 700; font-size: .8em;
} }
/* enrollment + a question at the same time: qr shrinks to the side */ /* a question on screen while the ring is up (vote with presence scans, late enrollment). the back rows read
.s-main.split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 5vw; } the ring, so it keeps the wider column and as much height as possible: title and entry qr share one line */
.s-main.split { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 4vw; }
.s-main.split .s-enroll { grid-template-columns: 1fr; justify-items: center; gap: 3vh; } .s-main.split .s-enroll { grid-template-columns: 1fr; justify-items: center; gap: 3vh; }
.s-main.split .s-enroll { grid-template-rows: minmax(0, 1fr) auto; gap: 2vh; height: 100%; } .s-main.split .s-enroll { grid-template-rows: minmax(0, 1fr) auto; gap: 1.5vh; height: 100%; }
.s-main.split .qr-wrap { height: 100%; width: auto; max-width: 100%; max-height: none; } .s-main.split .qr-wrap { height: 100%; width: auto; max-width: 100%; max-height: none; }
.s-main.split .entry { margin-top: 1.5vh; }
/* the question owns the screen, the ring keeps the room the step list would take */
.s-main.split #qr-steps { display: none; } .s-main.split #qr-steps { display: none; }
.s-main.split .entry canvas { width: clamp(90px, min(10vw, 15vh), 220px); } .s-main.split .s-steps { display: flex; align-items: center; justify-content: center; gap: 2vw; text-align: left; }
.s-main.split .s-steps { display: grid; justify-items: center; text-align: center; } .s-main.split .s-steps h2 { font-size: clamp(1.2rem, 2.1vw, 2.4rem); margin: 0; }
.s-main.split .s-steps h2 { font-size: clamp(1.4rem, 2.4vw, 2.6rem); } .s-main.split .entry { margin: 0; padding: .8vh .8vw; gap: .8vw; }
.s-main.split .entry canvas { width: clamp(70px, min(7vw, 11vh), 160px); }
.s-main.split .entry div { font-size: clamp(.7rem, .9vw, 1rem); }
.s-main.split .s-steps li { font-size: clamp(1rem, 1.5vw, 1.6rem); } .s-main.split .s-steps li { font-size: clamp(1rem, 1.5vw, 1.6rem); }
.s-focus { align-self: center; max-width: 1400px; width: 100%; margin: 0 auto; } .s-focus { align-self: center; max-width: 1400px; width: 100%; margin: 0 auto; }
@@ -88,7 +89,7 @@ body.screen {
/* upright + question: ring and entry share one row above the question */ /* upright + question: ring and entry share one row above the question */
.s-main.split .s-enroll { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: none; height: auto; align-items: center; justify-items: stretch; } .s-main.split .s-enroll { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: none; height: auto; align-items: center; justify-items: stretch; }
.s-main.split .qr-wrap { height: auto; width: 100%; max-height: 38vh; justify-self: center; } .s-main.split .qr-wrap { height: auto; width: 100%; max-height: 38vh; justify-self: center; }
.s-main.split .s-steps { grid-template-columns: auto; justify-items: center; row-gap: 1vh; } .s-main.split .s-steps { display: grid; grid-template-columns: auto; justify-items: center; row-gap: 1vh; text-align: center; }
.s-main.split .s-steps .entry { grid-column: 1; grid-row: auto; } .s-main.split .s-steps .entry { grid-column: 1; grid-row: auto; }
} }
.qr-wrap.ring .tick { display: none; } .qr-wrap.ring .tick { display: none; }
+6 -1
View File
@@ -76,4 +76,9 @@ dialog .actions button { flex: 1; }
display: grid; place-items: center; border: 0; color: #fff; background: rgba(20, 22, 36, .55); display: grid; place-items: center; border: 0; color: #fff; background: rgba(20, 22, 36, .55);
-webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
} }
.cam-switch:hover { border: 0; background: rgba(20, 22, 36, .75); } .cam-switch:hover, .cam-zoom:hover { border: 0; background: rgba(20, 22, 36, .75); }
.cam-zoom {
position: absolute; left: 10px; bottom: 10px; min-width: 44px; height: 44px; padding: 0 12px; border-radius: 22px;
border: 0; color: #fff; background: rgba(20, 22, 36, .55); font: 700 .95rem var(--round);
-webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
+17 -3
View File
@@ -104,14 +104,28 @@ function makeScanner(video, onToken, onOther) {
setTimeout(loop, Math.max(0, 66 - (performance.now() - t0))); setTimeout(loop, Math.max(0, 66 - (performance.now() - t0)));
} }
const swap = h("button", { class: "cam-switch", type: "button", "aria-label": "Changer de caméra", hidden: true }, icon("swap", 20)); const swap = h("button", { class: "cam-switch", type: "button", "aria-label": "Changer de caméra", hidden: true }, icon("swap", 20));
video.parentElement.append(swap); // sensor zoom (mostly android): a far ring gets real pixels instead of an upscaled 720p crop
const zoom = h("button", { class: "cam-zoom", type: "button", "aria-label": "Zoom", hidden: true }, "1×");
video.parentElement.append(swap, zoom);
let zooms = [1];
async function attach(s) { async function attach(s) {
stream = s; stream = s;
const track = s.getVideoTracks()[0];
// not every browser knows focusMode, those ignore it // not every browser knows focusMode, those ignore it
s.getVideoTracks()[0]?.applyConstraints({ advanced: [{ focusMode: "continuous" }] }).catch(() => {}); track?.applyConstraints({ advanced: [{ focusMode: "continuous" }] }).catch(() => {});
const cap = track?.getCapabilities?.().zoom;
zooms = cap && cap.max >= 1.5 ? [1, 2, 3].filter((z) => z >= cap.min && z <= cap.max) : [1];
zoom.hidden = zooms.length < 2;
zoom.textContent = "1×";
video.srcObject = s; video.srcObject = s;
await video.play(); await video.play();
} }
zoom.onclick = async () => {
const track = stream?.getVideoTracks()[0];
if (!track) return;
const next = zooms[(zooms.indexOf(+zoom.textContent.replace("×", "")) + 1) % zooms.length];
try { await track.applyConstraints({ advanced: [{ zoom: next }] }); zoom.textContent = `${next}×`; } catch { zoom.hidden = true; }
};
swap.onclick = async () => { swap.onclick = async () => {
const cams = rankCameras(await videoInputs()); const cams = rankCameras(await videoInputs());
if (cams.length < 2) return; if (cams.length < 2) return;
@@ -146,7 +160,7 @@ function makeScanner(video, onToken, onOther) {
stream?.getTracks().forEach((t) => t.stop()); stream?.getTracks().forEach((t) => t.stop());
video.srcObject = null; video.srcObject = null;
}, },
destroy() { swap.remove(); }, destroy() { swap.remove(); zoom.remove(); },
}; };
} }