Improve event labels and tooltips
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user