diff --git a/rotatyvote/app.py b/rotatyvote/app.py index 697c5e3..a6398d3 100644 --- a/rotatyvote/app.py +++ b/rotatyvote/app.py @@ -146,7 +146,8 @@ def entry_qr(base: str, pid: str): """static qr shown in a corner of the ring-code projector: opens the voting page from the camera app. upper case keeps it in qr alphanumeric mode, a smaller symbol (/V/ redirects to /v/)""" url = f"{base}/V/{pid}".upper() - return {"type": "entry", "modules": qr_modules(url, error="l"), "url": f"{base}/v/{pid}"} + # level q survives a glare patch or a smudge on a quarter of the symbol, and only grows 25 -> 29 modules + return {"type": "entry", "modules": qr_modules(url, error="q"), "url": f"{base}/v/{pid}"} def resolve_token(p, tok: str, grace_ms: int): diff --git a/static/css/screen.css b/static/css/screen.css index 6b61d8a..e2adce5 100644 --- a/static/css/screen.css +++ b/static/css/screen.css @@ -61,7 +61,7 @@ body.entry-q-on { --dock-qr: clamp(160px, min(46vh, 30vw), 520px); } /* a question on screen while the ring is up (vote with presence scans, late enrollment). the back rows read the ring, so it keeps the wider column and as much height as possible */ .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: minmax(0, 1fr); justify-items: center; gap: 3vh; } .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-steps { display: none; } @@ -155,3 +155,21 @@ body.entry-q-on { --dock-qr: clamp(160px, min(46vh, 30vw), 520px); } :fullscreen .s-tools .ctl-btn { display: inline-flex; opacity: .3; } :fullscreen .s-tools .ctl-btn:hover, :fullscreen .s-tools .ctl-btn:focus-visible { opacity: 1; } @media (prefers-reduced-motion: reduce) { .ctl { transition: none; } } + +/* drawer open: the projection keeps the space on its left. --room is that width */ +body.screen { --ctl-w: min(480px, 94vw); } +body.ctl-open { --room: calc(100vw - var(--ctl-w)); } +body.ctl-open :is(.s-head, .s-main, .s-foot) { margin-right: var(--ctl-w); } +body.ctl-open .entry { right: calc(var(--ctl-w) + 1.2vw); } +/* big qr: ring and qr share the room, the qr right against the ring */ +body.ctl-open.entry-big { --dock-qr: clamp(140px, min(46vh, calc(var(--room) * .34)), 520px); } +body.ctl-open.entry-big .s-main:not(.split) .qr-wrap { max-height: min(74vh, calc(var(--room) * .48)); } +body.ctl-open.entry-big .s-main:not(.split) .s-enroll { gap: 2vw; } +body.ctl-open.entry-big .entry { right: auto; left: calc(4vw + min(74vh, var(--room) * .48) + 2vw); } +body.ctl-open.split-on { --dock-qr: clamp(100px, min(22vh, calc(var(--room) * .2)), 260px); } +body.ctl-open .s-main.split .s-focus .q-text { font-size: clamp(1.1rem, min(calc(var(--room) * .04), 6vh), 3rem); } +body.ctl-open .s-main.split .s-focus .opts li { font-size: clamp(.9rem, min(calc(var(--room) * .024), 3.4vh), 1.8rem); } +/* narrow room: the ring follows its column's width, not the row's height */ +body.ctl-open .s-main.split .qr-wrap { width: 100%; height: auto; max-height: 100%; align-self: center; } +/* grid items won't shrink below their content by default: let the ring's column be as narrow as the room */ +.s-main > section { min-width: 0; } diff --git a/static/js/screen.js b/static/js/screen.js index a2bd55f..4d343eb 100644 --- a/static/js/screen.js +++ b/static/js/screen.js @@ -239,8 +239,12 @@ if (present) { if (open && !drawer.querySelector("iframe")) { drawer.append(h("iframe", { src: `/admin/${pid}#${encodeURIComponent(key)}`, title: "Administration" })); } + // the projection folds into the room the drawer leaves, the entry qr slides along + const entryEl = $("#entry"), before = entryEl.hidden ? null : entryEl.getBoundingClientRect(); drawer.classList.toggle("open", open); + document.body.classList.toggle("ctl-open", open); btn.setAttribute("aria-expanded", String(open)); + flip(entryEl, before); }; btn.addEventListener("click", () => toggle(!drawer.classList.contains("open"))); close.addEventListener("click", () => toggle(false));