PanelSheets: say that sheets are numbered from 0, in the docs and in sliceFor's error

This commit is contained in:
Doxa Maps 2026-09-30 22:08:23 +00:00
parent 332aa002f8
commit f5ec4a1809

View file

@ -58,13 +58,13 @@ export function planPanels(o) {
}
/**
* The part of the FINISHED poster that sheet s prints, and where on the sheet it goes (inches). With 'bleed' the
* The part of the FINISHED poster that sheet s (0-based: 0 … count − 1) prints, and where on the sheet it goes (inches). With 'bleed' the
* whole sheet is poster (its band repeats what the sheet before shows); with 'glue' the band is left out.
* A renderer draws the finished poster once and places this rect of it on page s (the per-sheet PDF page).
*/
export function sliceFor(plan, s) {
const sh = plan.sheets[s]
if (!sh) throw new Error(`sliceFor: no sheet ${s} (the plan has ${plan.count})`)
if (!sh) throw new Error(`sliceFor: no sheet ${s}; sheets are 0-based, 0..${plan.count - 1}`)
const skip = plan.joinFill === 'glue' && sh.band ? plan.joinIn : 0
const V = plan.direction === 'vertical'
return V
@ -97,7 +97,7 @@ const esc = (v) => String(v ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '
const inch = (v) => v.toFixed(3) + 'in'
/**
* The join marks for sheet s, as HTML to place inside the sheet's own positioned box (class "sheet"):
* The join marks for sheet s (0-based), as HTML to place inside the sheet's own positioned box (class "sheet"):
* before — the join band ("glue here ▲ s / N"), drawn first so content paints over nothing it needs;
* after — the trim line on a trimmed edge, and the "s / N" sheet tag in the corner.
* `screen: true` always draws the red band (a preview shows how the sheets join, even for a bleed print).