Sets up calendar package with core infrastructure
Adds core calendar package components including: - Base services for events, resources, and settings - Calendar app and orchestrator - Build and bundling configuration - IndexedDB storage setup Prepares foundational architecture for calendar functionality
This commit is contained in:
parent
12e7594f30
commit
ceb44446f0
97 changed files with 13858 additions and 1 deletions
42
packages/calendar/src/core/ScrollManager.ts
Normal file
42
packages/calendar/src/core/ScrollManager.ts
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
export class ScrollManager {
|
||||
private scrollableContent!: HTMLElement;
|
||||
private timeAxisContent!: HTMLElement;
|
||||
private calendarHeader!: HTMLElement;
|
||||
private headerDrawer!: HTMLElement;
|
||||
private headerViewport!: HTMLElement;
|
||||
private headerSpacer!: HTMLElement;
|
||||
private resizeObserver!: ResizeObserver;
|
||||
|
||||
init(container: HTMLElement): void {
|
||||
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')!;
|
||||
|
||||
this.scrollableContent.addEventListener('scroll', () => this.onScroll());
|
||||
|
||||
// Synkroniser header-spacer højde med header-viewport
|
||||
this.resizeObserver = new ResizeObserver(() => this.syncHeaderSpacerHeight());
|
||||
this.resizeObserver.observe(this.headerViewport);
|
||||
this.syncHeaderSpacerHeight();
|
||||
}
|
||||
|
||||
private syncHeaderSpacerHeight(): void {
|
||||
// Kopier den faktiske computed height direkte fra header-viewport
|
||||
const computedHeight = getComputedStyle(this.headerViewport).height;
|
||||
this.headerSpacer.style.height = computedHeight;
|
||||
}
|
||||
|
||||
private onScroll(): void {
|
||||
const { scrollTop, scrollLeft } = this.scrollableContent;
|
||||
|
||||
// Synkroniser time-axis vertikalt
|
||||
this.timeAxisContent.style.transform = `translateY(-${scrollTop}px)`;
|
||||
|
||||
// Synkroniser header og drawer horisontalt
|
||||
this.calendarHeader.style.transform = `translateX(-${scrollLeft}px)`;
|
||||
this.headerDrawer.style.transform = `translateX(-${scrollLeft}px)`;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue