Improves all-day event drag and drop

Handles dragging of both timed events (converting to all-day) and existing all-day events to different days.

Refactors all-day height recalculation to support animated transitions for a smoother user experience when all-day event counts change.

Uses event delegation for header mouseover detection.

Updates ScrollManager to listen for header height changes.
This commit is contained in:
Janus Knudsen 2025-08-25 21:20:51 +02:00
parent 6ede297bb5
commit f2763ad826
6 changed files with 186 additions and 48 deletions

View file

@ -186,17 +186,10 @@ export abstract class BaseEventRenderer implements EventRendererStrategy {
? (maxStackHeight * ALL_DAY_CONSTANTS.EVENT_HEIGHT) + ((maxStackHeight - 1) * ALL_DAY_CONSTANTS.EVENT_GAP) + ALL_DAY_CONSTANTS.CONTAINER_PADDING
: 0; // No height if no events
// Set CSS variable for row height
// Only set CSS variable - header-spacer height is handled by CSS calc()
const root = document.documentElement;
root.style.setProperty('--all-day-row-height', `${calculatedHeight}px`);
// Also update header-spacer height
const headerSpacer = container.querySelector('swp-header-spacer');
if (headerSpacer) {
const headerHeight = parseInt(getComputedStyle(root).getPropertyValue('--header-height') || '80');
(headerSpacer as HTMLElement).style.height = `${headerHeight + calculatedHeight}px`;
}
console.log(`BaseEventRenderer: Set all-day row height to ${calculatedHeight}px (max stack: ${maxStackHeight})`);
}