fix(po): place stamp clear of the signature (no overlap)
Signatures/stamps aren't always transparent PNGs, so an opaque stamp would cover the signature/name where it overlapped. Position the stamp to the right of the centred signature with a 10px gap so it never overlays either. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
610c9aa56d
commit
15d8a0bc3b
1 changed files with 5 additions and 2 deletions
|
|
@ -478,11 +478,14 @@ export async function GET(request: NextRequest, { params }: Props) {
|
||||||
const sigExt = signatureBase64 ? scaleToBox(signatureSize ?? { width: 360, height: 96 }, 165, 44) : null;
|
const sigExt = signatureBase64 ? scaleToBox(signatureSize ?? { width: 360, height: 96 }, 165, 44) : null;
|
||||||
const sigLeft = sigExt ? Math.round((SIG_BLOCK_PX - sigExt.width) / 2) : 0; // centred over the name
|
const sigLeft = sigExt ? Math.round((SIG_BLOCK_PX - sigExt.width) / 2) : 0; // centred over the name
|
||||||
|
|
||||||
// Stamp / seal — drawn FIRST so it sits BEHIND the signature, tucked to its right.
|
// Stamp / seal — placed to the RIGHT of the signature with a gap, so it never
|
||||||
|
// overlays the signature or name (stamps/signatures aren't always transparent PNGs).
|
||||||
|
// Still drawn before the signature so it layers behind if they ever touch.
|
||||||
if (stampImg) {
|
if (stampImg) {
|
||||||
const stampExt = scaleToBox(stampImg, 80, 66);
|
const stampExt = scaleToBox(stampImg, 80, 66);
|
||||||
|
const STAMP_GAP = 10;
|
||||||
const stampLeft = sigExt
|
const stampLeft = sigExt
|
||||||
? Math.min(SIG_BLOCK_PX - stampExt.width, sigLeft + sigExt.width - Math.round(stampExt.width * 0.35))
|
? Math.min(SIG_BLOCK_PX - stampExt.width, sigLeft + sigExt.width + STAMP_GAP)
|
||||||
: SIG_BLOCK_PX - stampExt.width - 6;
|
: SIG_BLOCK_PX - stampExt.width - 6;
|
||||||
const stampId = wb.addImage({
|
const stampId = wb.addImage({
|
||||||
base64: stampImg.base64,
|
base64: stampImg.base64,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue