A step in the right direction for this time axis

This commit is contained in:
Janus Knudsen 2025-08-01 23:45:13 +02:00
parent b6d3d22ce9
commit 209ae0830d
4 changed files with 33 additions and 11 deletions

View file

@ -166,6 +166,7 @@ export class GridManager {
if (!this.grid) return;
const timeAxis = document.createElement('swp-time-axis');
const timeAxisContent = document.createElement('swp-time-axis-content');
const startHour = calendarConfig.get('dayStartHour');
const endHour = calendarConfig.get('dayEndHour');
@ -174,9 +175,10 @@ export class GridManager {
const period = hour >= 12 ? 'PM' : 'AM';
const displayHour = hour > 12 ? hour - 12 : (hour === 0 ? 12 : hour);
marker.textContent = `${displayHour} ${period}`;
timeAxis.appendChild(marker);
timeAxisContent.appendChild(marker);
}
timeAxis.appendChild(timeAxisContent);
this.grid.appendChild(timeAxis);
}

View file

@ -397,13 +397,16 @@ export class ScrollManager {
if (!this.scrollableContent || !this.timeAxis) return;
const scrollTop = this.scrollableContent.scrollTop;
const timeAxisContent = this.timeAxis.querySelector('swp-time-axis-content');
// Use transform for smooth performance
this.timeAxis.style.transform = `translateY(-${scrollTop}px)`;
// Debug logging (can be removed later)
if (scrollTop % 100 === 0) { // Only log every 100px to avoid spam
console.log(`ScrollManager: Synced time-axis to scrollTop: ${scrollTop}px`);
if (timeAxisContent) {
// Use transform for smooth performance
timeAxisContent.style.transform = `translateY(-${scrollTop}px)`;
// Debug logging (can be removed later)
if (scrollTop % 100 === 0) { // Only log every 100px to avoid spam
console.log(`ScrollManager: Synced time-axis to scrollTop: ${scrollTop}px`);
}
}
}