Just some cleanup

This commit is contained in:
Janus Knudsen 2025-08-13 23:05:58 +02:00
parent cdc7e55a92
commit b03707853a
3 changed files with 63 additions and 88 deletions

View file

@ -50,24 +50,6 @@ export class EventRenderer {
// Use strategy to render events
eventRenderer.renderEvents(events, calendarConfig);
// Debug: Check if events are actually in DOM after rendering
setTimeout(() => {
const allRenderedEvents = document.querySelectorAll('swp-event');
console.log(`EventRenderer: DOM check - ${allRenderedEvents.length} swp-event elements found in DOM`);
if (allRenderedEvents.length > 0) {
const firstEvent = allRenderedEvents[0] as HTMLElement;
console.log('EventRenderer: First event DOM details:', {
visible: firstEvent.offsetWidth > 0 && firstEvent.offsetHeight > 0,
offsetParent: !!firstEvent.offsetParent,
computedDisplay: window.getComputedStyle(firstEvent).display,
computedVisibility: window.getComputedStyle(firstEvent).visibility,
computedOpacity: window.getComputedStyle(firstEvent).opacity,
parentElement: firstEvent.parentElement?.tagName
});
}
}, 100);
console.log(`EventRenderer: Successfully rendered ${events.length} events`);
}

View file

@ -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
});
}
/**