Just some cleanup
This commit is contained in:
parent
cdc7e55a92
commit
b03707853a
3 changed files with 63 additions and 88 deletions
|
|
@ -33,20 +33,14 @@ export class ScrollManager {
|
|||
}
|
||||
|
||||
private subscribeToEvents(): void {
|
||||
// State events removed - initialize() is now called directly after grid render
|
||||
|
||||
// Handle new period shown
|
||||
//we need to subscribe to appropriate event and then call setupScrolling() again
|
||||
|
||||
// Handle window resize
|
||||
window.addEventListener('resize', () => {
|
||||
this.updateScrollableHeight();
|
||||
});
|
||||
|
||||
// Handle config updates for scrollbar styling
|
||||
eventBus.on(EventTypes.CONFIG_UPDATE, (event: Event) => {
|
||||
const { key } = (event as CustomEvent).detail;
|
||||
if (key.startsWith('scrollbar')) {
|
||||
this.applyScrollbarStyling();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -59,7 +53,6 @@ export class ScrollManager {
|
|||
this.setupResizeObserver();
|
||||
this.updateScrollableHeight();
|
||||
this.setupScrollSynchronization();
|
||||
this.applyScrollbarStyling();
|
||||
}
|
||||
|
||||
// Setup horizontal scrolling synchronization
|
||||
|
|
@ -68,45 +61,6 @@ export class ScrollManager {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply scrollbar styling from configuration
|
||||
*/
|
||||
private applyScrollbarStyling(): void {
|
||||
if (!this.scrollableContent) return;
|
||||
|
||||
// Get scrollbar configuration
|
||||
const scrollbarWidth = calendarConfig.get('scrollbarWidth');
|
||||
const scrollbarColor = calendarConfig.get('scrollbarColor');
|
||||
const scrollbarTrackColor = calendarConfig.get('scrollbarTrackColor');
|
||||
const scrollbarHoverColor = calendarConfig.get('scrollbarHoverColor');
|
||||
const scrollbarBorderRadius = calendarConfig.get('scrollbarBorderRadius');
|
||||
|
||||
// Apply CSS custom properties to both the element and document root
|
||||
const root = document.documentElement;
|
||||
|
||||
// Set on scrollable content
|
||||
this.scrollableContent.style.setProperty('--scrollbar-width', `${scrollbarWidth}px`);
|
||||
this.scrollableContent.style.setProperty('--scrollbar-color', scrollbarColor);
|
||||
this.scrollableContent.style.setProperty('--scrollbar-track-color', scrollbarTrackColor);
|
||||
this.scrollableContent.style.setProperty('--scrollbar-hover-color', scrollbarHoverColor);
|
||||
this.scrollableContent.style.setProperty('--scrollbar-border-radius', `${scrollbarBorderRadius}px`);
|
||||
|
||||
// Also set on root for global access
|
||||
root.style.setProperty('--scrollbar-width', `${scrollbarWidth}px`);
|
||||
root.style.setProperty('--scrollbar-color', scrollbarColor);
|
||||
root.style.setProperty('--scrollbar-track-color', scrollbarTrackColor);
|
||||
root.style.setProperty('--scrollbar-hover-color', scrollbarHoverColor);
|
||||
root.style.setProperty('--scrollbar-border-radius', `${scrollbarBorderRadius}px`);
|
||||
|
||||
console.log('ScrollManager: Applied scrollbar styling', {
|
||||
width: `${scrollbarWidth}px`,
|
||||
color: scrollbarColor,
|
||||
trackColor: scrollbarTrackColor,
|
||||
hoverColor: scrollbarHoverColor,
|
||||
borderRadius: `${scrollbarBorderRadius}px`
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Find DOM elements needed for scrolling
|
||||
*/
|
||||
|
|
@ -115,13 +69,7 @@ export class ScrollManager {
|
|||
this.calendarContainer = document.querySelector('swp-calendar-container');
|
||||
this.timeAxis = document.querySelector('swp-time-axis');
|
||||
this.calendarHeader = document.querySelector('swp-calendar-header');
|
||||
|
||||
console.log('ScrollManager: Found elements:', {
|
||||
scrollableContent: !!this.scrollableContent,
|
||||
calendarContainer: !!this.calendarContainer,
|
||||
timeAxis: !!this.timeAxis,
|
||||
calendarHeader: !!this.calendarHeader
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue