diff --git a/web/canvas.ts b/web/canvas.ts index bf2ff5d..c89e746 100644 --- a/web/canvas.ts +++ b/web/canvas.ts @@ -512,6 +512,37 @@ export function paintMeasure(document: Document): () => void { // lines against the edges would be noise claiming to be information. if (box.width >= (document.documentElement.clientWidth || 0) - 1) return; + /* + The margins THEMSELVES, not only the lines that bound them. + + Two hairlines say where the measure ends and leave the reader to notice that the space outside is + empty. Tinting it says what that space IS: room the page is not using, which is the question + somebody widening a gutter or judging a desktop layout is actually asking. On a narrow frame there + is nothing to tint and the block below returns before drawing any of it. + */ + for (const [side, from, width] of [ + ['left', 0, box.left], + ['right', box.right, (document.documentElement.clientWidth || 0) - box.right], + ] as const) { + if (width <= 0) continue; + const margin = document.createElement('div'); + margin.setAttribute(MARK, `measure-margin-${side}`); + style(margin, [ + 'position:fixed', + 'top:0', + 'bottom:0', + `left:${Math.round(from)}px`, + `width:${Math.round(width)}px`, + // Faint, because this is the part of the screen the page does NOT occupy: it has to read as + // absence. Anything stronger competes with the content for the eye. + `background:color-mix(in srgb, ${ACCENT} 7%, transparent)`, + 'pointer-events:none', + 'z-index:2147482999', + ]); + document.body.append(margin); + guides.push(margin); + } + for (const [side, x] of [ ['left', box.left], ['right', box.right],