Syncs header drawer scroll with calendar header

Adds horizontal scrolling synchronization for header drawer
Ensures consistent horizontal scroll positioning for header components
This commit is contained in:
Janus C. H. Knudsen 2025-12-15 20:02:38 +01:00
parent 570c91527a
commit f20b8a47fa

View file

@ -2,6 +2,7 @@ export class ScrollManager {
private scrollableContent!: HTMLElement;
private timeAxisContent!: HTMLElement;
private calendarHeader!: HTMLElement;
private headerDrawer!: HTMLElement;
private headerViewport!: HTMLElement;
private headerSpacer!: HTMLElement;
private resizeObserver!: ResizeObserver;
@ -10,6 +11,7 @@ export class ScrollManager {
this.scrollableContent = container.querySelector('swp-scrollable-content')!;
this.timeAxisContent = container.querySelector('swp-time-axis-content')!;
this.calendarHeader = container.querySelector('swp-calendar-header')!;
this.headerDrawer = container.querySelector('swp-header-drawer')!;
this.headerViewport = container.querySelector('swp-header-viewport')!;
this.headerSpacer = container.querySelector('swp-header-spacer')!;
@ -33,7 +35,8 @@ export class ScrollManager {
// Synkroniser time-axis vertikalt
this.timeAxisContent.style.transform = `translateY(-${scrollTop}px)`;
// Synkroniser header horisontalt
// Synkroniser header og drawer horisontalt
this.calendarHeader.style.transform = `translateX(-${scrollLeft}px)`;
this.headerDrawer.style.transform = `translateX(-${scrollLeft}px)`;
}
}