Fix item separator line overlapping last expense line of previous item

y was at the stripe bottom when the separator was drawn at y+lh,
landing inside the previous stripe. Dropping y by lh first puts the
separator in the gap between the two items.
This commit is contained in:
Claude 2026-05-24 18:59:34 +00:00
parent f1d1ae71ee
commit a94a2ed4eb
No known key found for this signature in database

View file

@ -954,8 +954,11 @@ async function generatePDF() {
// Items // Items
state.items.forEach((item, itemIdx) => { state.items.forEach((item, itemIdx) => {
// Item header // Item header
needSpace(lh * 6); // need room for at least header + one line needSpace(lh * 7); // need room for separator gap + header + one line
if (itemIdx > 0) pg.drawLine({start:{x:M.left, y:y+lh}, end:{x:M.left+W, y:y+lh}, thickness:0.75, color:accent}); if (itemIdx > 0) {
y -= lh; // create gap below previous item before drawing separator
pg.drawLine({start:{x:M.left, y:y+lh}, end:{x:M.left+W, y:y+lh}, thickness:0.75, color:accent});
}
pg.drawText('ITEM / PROJECT / TRAVEL', {x:M.left, y, size:sz, font:fontBold, color:accent}); pg.drawText('ITEM / PROJECT / TRAVEL', {x:M.left, y, size:sz, font:fontBold, color:accent});
const subStr = `Subtotal: ${baseCur} ${fmtAmt(item._subtotal)}`; const subStr = `Subtotal: ${baseCur} ${fmtAmt(item._subtotal)}`;
const subW = fontBold.widthOfTextAtSize(subStr, sz); const subW = fontBold.widthOfTextAtSize(subStr, sz);