fix connector alignment: use spread pct for pins and connector lines

This commit is contained in:
2026-08-08 20:34:01 +02:00
parent 9402456020
commit 7a17711f60
+9 -3
View File
@@ -899,7 +899,7 @@
<template x-for="ev in eventsForProject(item.id)" :key="ev.id"> <template x-for="ev in eventsForProject(item.id)" :key="ev.id">
<a class="tl-project-evt-dot" <a class="tl-project-evt-dot"
:class="ev.mood || (game && game.mood) || 'light'" :class="ev.mood || (game && game.mood) || 'light'"
:style="`left:${posPercent(ev.date)}%`" :style="`left:${spreadPct(ev.id, ev.date)}%`"
:href="'#entry-' + ev.id" :href="'#entry-' + ev.id"
:title="ev.title + ' — ' + ev.date" :title="ev.title + ' — ' + ev.date"
@click.stop></a> @click.stop></a>
@@ -2146,8 +2146,14 @@
return result.sort((a, b) => a.term.localeCompare(b.term)) return result.sort((a, b) => a.term.localeCompare(b.term))
}, },
// Spread pct: use the adjusted position from tlItems so connectors/pins
// align with the main-rail callout dot (which gets nudged to avoid overlap).
spreadPct(evId, fallbackDate) {
const item = this.tlItems.find(i => i.id === evId)
return item ? item.pct : this.posPercent(fallbackDate)
},
// Vertical connector lines from main-rail event dots down to project pins. // Vertical connector lines from main-rail event dots down to project pins.
// SUBLABEL_H ≈ 1rem margin-top + 10px text + 6px margin-bottom = 32px
projectConnectors() { projectConnectors() {
if (!this.game) return [] if (!this.game) return []
const projs = this.projects() const projs = this.projects()
@@ -2158,7 +2164,7 @@
.map(ev => { .map(ev => {
const idx = projs.findIndex(p => p.id === ev.project_id) const idx = projs.findIndex(p => p.id === ev.project_id)
if (idx === -1) return null if (idx === -1) return null
const pct = this.posPercent(ev.date) const pct = this.spreadPct(ev.id, ev.date)
const topY = this.tlRailY() const topY = this.tlRailY()
const pinY = this.tlHeight() + SUBLABEL_H + idx * ROW_H + PIN_LEVEL const pinY = this.tlHeight() + SUBLABEL_H + idx * ROW_H + PIN_LEVEL
return { id: ev.id, pct, top: topY, height: Math.max(0, pinY - topY) } return { id: ev.id, pct, top: topY, height: Math.max(0, pinY - topY) }