From 955d28d9c5f3269f68e477ea2dade337a07da26c Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Mon, 8 Jun 2026 20:07:59 -0400 Subject: [PATCH] fix(badges): shrink punch-hole markers horizontally, add inset_x_mm config Default horizontal inset increased from 1mm to 2mm per side (width shrinks by 4mm total) so markers stay inside the physical hole slot on all printers and badge stock with minor registration variance. Vertical stays at 1mm. The inset is now driven by punch_holes_inset_x (template_cfg.punch_holes .inset_x_mm, default 2) so it can be tuned per template without a code change. Added inset_x_mm field to AeBadgeTemplateCfg type with doc comment. All 9 slot marker divs (6 rainbow + 3 solid) updated via replace_all. Co-Authored-By: Claude Sonnet 4.6 --- .../ae_events/types/ae_badge_template_cfg.ts | 4 +++ .../[badge_id]/ae_comp__badge_obj_view.svelte | 28 ++++++++++++------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/lib/ae_events/types/ae_badge_template_cfg.ts b/src/lib/ae_events/types/ae_badge_template_cfg.ts index 83a43f46..52d986fa 100644 --- a/src/lib/ae_events/types/ae_badge_template_cfg.ts +++ b/src/lib/ae_events/types/ae_badge_template_cfg.ts @@ -76,6 +76,10 @@ export interface BadgeTemplateCfg { center_bg?: string; center_rainbow?: boolean; slow_pulse?: boolean; // when true: slow breathing pulse instead of fast linear cycle + // Extra horizontal inset per side (mm) beyond the 1mm base safety margin. + // Shrinks the visible marker width to keep it inside the physical hole on + // printers or badge stock with variance. Default 2 when unset (see view component). + inset_x_mm?: number; }; // Allow arbitrary extra keys to preserve forward-compatibility. diff --git a/src/routes/events/[event_id]/(badges)/badges/[badge_id]/ae_comp__badge_obj_view.svelte b/src/routes/events/[event_id]/(badges)/badges/[badge_id]/ae_comp__badge_obj_view.svelte index 792d73de..28f1ff49 100644 --- a/src/routes/events/[event_id]/(badges)/badges/[badge_id]/ae_comp__badge_obj_view.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/[badge_id]/ae_comp__badge_obj_view.svelte @@ -332,6 +332,11 @@ let punch_holes_left = $derived(!!template_cfg?.punch_holes?.left); let punch_holes_right = $derived(!!template_cfg?.punch_holes?.right); let punch_holes_center = $derived(!!template_cfg?.punch_holes?.center); +// Horizontal inset per side applied to each marker, in mm. +// Default 2mm — enough to stay inside the hole on real badge stock with typical printer variance. +// Increase via punch_holes.inset_x_mm in the template config if a printer or stock runs long. +let punch_holes_inset_x = $derived(template_cfg?.punch_holes?.inset_x_mm ?? 2); + // Per-slot colors: slot-specific override → shared fallback → component default. // When rainbow is on and no explicit fg/bg is set, use a saturated base color so // hue-rotate produces a full visible spectrum (gray has no hue to rotate). @@ -697,7 +702,10 @@ const code_to_icon: {