Improves all-day event hover detection

Enhances the all-day event selection by creating transparent, full-height columns for each day, which enables more accurate and reliable hover detection across all-day events.

Now selects all-day events by hovering on the entire column, not just day headers.
This commit is contained in:
Janus Knudsen 2025-09-17 22:08:27 +02:00
parent 3db93a9e89
commit b4af5a9211
3 changed files with 44 additions and 3 deletions

View file

@ -26,12 +26,40 @@ export class AllDayEventRenderer {
if (!this.container) {
this.container = document.createElement('swp-allday-container');
header.appendChild(this.container);
// Create ghost columns for mouseenter events
this.createGhostColumns();
}
}
}
return this.container;
}
/**
* Create ghost columns for mouseenter events
*/
private createGhostColumns(): void {
if (!this.container) return;
// Get all day headers to create matching ghost columns
const dayHeaders = document.querySelectorAll('swp-day-header');
dayHeaders.forEach((header, index) => {
const ghostColumn = document.createElement('swp-allday-column');
const headerElement = header as HTMLElement;
// Copy date from corresponding day header
if (headerElement.dataset.date) {
ghostColumn.dataset.date = headerElement.dataset.date;
}
// Set grid column position (1-indexed)
ghostColumn.style.gridColumn = (index + 1).toString();
ghostColumn.style.gridRow = '1 / -1'; // Span all rows
this.container!.appendChild(ghostColumn);
});
}
/**
* Render an all-day event using factory pattern
*/