Improve event labels and tooltips

This commit is contained in:
Kiyomichi Kosaka
2025-06-20 08:20:13 +02:00
parent 7a8a463169
commit 6c868f3768
2 changed files with 37 additions and 5 deletions
+26 -1
View File
@@ -740,7 +740,13 @@ function showEonstripDetail(index, startCob) {
while (occ < end && occ <= endCobEv) {
const relStart = (occ - start) / COBIE_UNITS.eonstrip;
const relEnd = (occ + duration - start) / COBIE_UNITS.eonstrip;
events.push({ label: ev.label, start: relStart, end: relEnd });
events.push({
label: ev.label,
start: relStart,
end: relEnd,
cobStart: occ,
cobEnd: occ + duration
});
occ += interval;
}
});
@@ -782,6 +788,25 @@ function showEonstripDetail(index, startCob) {
} else {
elem.textContent = ev.label;
}
const tooltip = document.createElement('div');
tooltip.className = 'tooltip';
const opts = {
timeZone: currentTimezone === 'TAI' ? 'UTC' : currentTimezone,
year: 'numeric', month: 'short', day: 'numeric',
hour: '2-digit', minute: '2-digit', second: '2-digit',
hour12: false
};
const startStr = formatCobieTimestamp(ev.cobStart);
const endStr = formatCobieTimestamp(ev.cobEnd);
const startDate = fromCobiets(ev.cobStart).toLocaleString('en-US', opts);
const endDate = fromCobiets(ev.cobEnd).toLocaleString('en-US', opts);
tooltip.innerHTML =
`<strong>${ev.label}</strong><br>` +
`Start: ${startStr}<br>` +
`End: ${endStr}<br>` +
`${startDate} ${endDate}`;
elem.appendChild(tooltip);
timeline.appendChild(elem);
});
}