From 7411160a23fe2e20cb9314795497e711361f3ec1 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Wed, 4 Feb 2026 12:04:02 +0100 Subject: [PATCH] rosary: derive SVG bead positions from sectionPositions dictionary Use sectionPositions as single source of truth for all bead coordinates. Compute transition bead positions as midpoints between decades, generate decade beads and hitboxes via loops, and adjust bead spacing. --- .../[rosary=rosaryLang]/+page.svelte | 160 ++++++++---------- 1 file changed, 66 insertions(+), 94 deletions(-) diff --git a/src/routes/[faithLang=faithLang]/[rosary=rosaryLang]/+page.svelte b/src/routes/[faithLang=faithLang]/[rosary=rosaryLang]/+page.svelte index 7afaff4..ece40ce 100644 --- a/src/routes/[faithLang=faithLang]/[rosary=rosaryLang]/+page.svelte +++ b/src/routes/[faithLang=faithLang]/[rosary=rosaryLang]/+page.svelte @@ -355,29 +355,34 @@ function handleCitationClick(reference, title = '', verseData = null) { } // Map sections to their vertical positions in the SVG +const BEAD_SPACING = 22; +const DECADE_OFFSET = 10; const sectionPositions = { cross: 35, - lbead1: 80, + lbead1: 75, start1: 110, start2: 135, start3: 160, - lbead2: 200, + lbead2: 195, secret1: 270, - secret1_transition: 520, secret2: 560, - secret2_transition: 800, secret3: 840, - secret3_transition: 1080, secret4: 1120, - secret4_transition: 1360, secret5: 1400, - final_transition: 1690, - final_salve: 1730, - final_schlussgebet: 1760, - final_michael: 1790, - final_paternoster: 1830, - final_cross: 1920 + final_transition: 1685, + final_salve: 1720, + final_schlussgebet: 1745, + final_michael: 1770, + final_paternoster: 1805, + final_cross: 1900 }; +// Center transition beads between last bead of decade d and first bead of decade d+1 +for (let d = 1; d < 5; d++) { + const lastBead = sectionPositions[`secret${d}`] + DECADE_OFFSET + 9 * BEAD_SPACING; + const nextFirst = sectionPositions[`secret${d + 1}`] + DECADE_OFFSET; + sectionPositions[`secret${d}_transition`] = Math.round((lastBead + nextFirst) / 2); +} +const pos = sectionPositions; onMount(() => { // Load toggle state from localStorage @@ -1331,87 +1336,56 @@ h1 {
- + - - + - - - + + + - + - + - - {#each Array(10) as _, i} - - {/each} - - - - - {#each Array(10) as _, i} - - {/each} - - - - - {#each Array(10) as _, i} - - {/each} - - - - - {#each Array(10) as _, i} - - {/each} - - - - - {#each Array(10) as _, i} - + + {#each [1, 2, 3, 4, 5] as d} + {@const decadePos = pos[`secret${d}`]} + {@const transPos = pos[`secret${d}_transition`]} + + {#each Array(10) as _, i} + + {/each} + + {#if d < 5} + + {/if} {/each} - + - + - - - + + + - + - @@ -1421,30 +1395,28 @@ h1 { - - - - - + + + + + - - - - - - + + {#each [1, 2, 3, 4, 5] as d} + {@const decadePos = pos[`secret${d}`]} + + {/each} - - - - - - - - - - + {#each [1, 2, 3, 4] as d} + + {/each} + + + + + +