Big entry qr comes back while a closed vote waits for its results; progress ring fill uses real dash lengths (pathLength broke on some android webviews)
This commit is contained in:
+8
-2
@@ -180,13 +180,18 @@ export function ring(n, total, size = 160, label = `${n}/${total}`) {
|
||||
for (let i = 0; i < total; i++) {
|
||||
const s0 = i * slot + (gap + sw) / 2;
|
||||
const d = `M ${at(s0)} A ${r} ${r} 0 ${seg / r > Math.PI ? 1 : 0} 1 ${at(s0 + seg)}`;
|
||||
// track underneath, fill on top sweeps clockwise through pathLength 1
|
||||
// track underneath, fill on top sweeps clockwise. dash lengths in real units: some android webviews
|
||||
// mishandle pathLength and draw the fill whole or not at all
|
||||
for (const cls of ["seg", "fill"]) {
|
||||
const el = document.createElementNS(SVGNS, "path");
|
||||
el.setAttribute("d", d);
|
||||
el.setAttribute("stroke-width", sw);
|
||||
el.setAttribute("class", cls);
|
||||
if (cls === "fill") { el.setAttribute("pathLength", 1); fills.push(el); }
|
||||
if (cls === "fill") {
|
||||
el.style.strokeDasharray = `${seg} ${seg + sw * 2}`;
|
||||
el.style.strokeDashoffset = String(seg);
|
||||
fills.push(el);
|
||||
}
|
||||
svg.append(el);
|
||||
}
|
||||
}
|
||||
@@ -199,6 +204,7 @@ export function ring(n, total, size = 160, label = `${n}/${total}`) {
|
||||
fills.forEach((el, i) => {
|
||||
el.classList.toggle("on", i < k);
|
||||
el.classList.toggle("last", i === k - 1 && k < total);
|
||||
el.style.strokeDashoffset = String(i < k ? 0 : seg);
|
||||
});
|
||||
t.textContent = text;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user