Refactors header drag interaction to eliminate ghost columns

Updates the `HeaderManager` to utilize `mouseenter` and `mouseleave` events on the calendar header for improved performance and accuracy.
Calculates the target date based on the mouse's X-coordinate within the header.

Removes the need for 'ghost columns' by simplifying the logic. This significantly reduces complexity.
The `AllDayEventRenderer` is modified to reflect this change, omitting ghost column creation.

Updates `DragDropManager` to accommodate the new interaction model.
Various console logs are added for debugging purposes.
This commit is contained in:
Janus Knudsen 2025-09-18 17:55:52 +02:00
parent 18e80bbce2
commit fb40279009
5 changed files with 353 additions and 55 deletions

View file

@ -96,18 +96,36 @@ export class DragDropManager {
this.eventBus.on('header:mouseover', (event) => {
const { targetDate, headerRenderer } = (event as CustomEvent).detail;
console.log('🎯 DragDropManager: Received header:mouseover', {
targetDate,
draggedEventId: this.draggedEventId,
isDragging: !!this.draggedEventId
});
if (this.draggedEventId && targetDate) {
// Find dragget element dynamisk
const draggedElement = document.querySelector(`swp-event[data-event-id="${this.draggedEventId}"]`);
console.log('🔍 DragDropManager: Looking for dragged element', {
eventId: this.draggedEventId,
found: !!draggedElement,
tagName: draggedElement?.tagName
});
if (draggedElement) {
console.log('✅ DragDropManager: Converting to all-day for date:', targetDate);
// Element findes stadig som day-event, så konverter
this.eventBus.emit('drag:convert-to-allday', {
targetDate,
originalElement: draggedElement,
headerRenderer
});
} else {
console.log('❌ DragDropManager: Dragged element not found');
}
} else {
console.log('⏭️ DragDropManager: Skipping conversion - no drag or no target date');
}
});