Improves drag and drop behavior
Hides the drag clone when moving events to the all-day area and shows it again when the mouse leaves the header to prevent visual inconsistencies. Ensures only the correct all-day event is removed by specifying the container in the selector.
This commit is contained in:
parent
8f1c32c9f9
commit
7e45293128
1 changed files with 14 additions and 3 deletions
|
|
@ -107,6 +107,12 @@ export class DragDropManager {
|
||||||
originalElement: draggedElement,
|
originalElement: draggedElement,
|
||||||
headerRenderer
|
headerRenderer
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Hide drag clone completely
|
||||||
|
const dragClone = document.querySelector(`swp-event[data-event-id="clone-${this.draggedEventId}"]`);
|
||||||
|
if (dragClone) {
|
||||||
|
(dragClone as HTMLElement).style.display = 'none';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -129,11 +135,16 @@ export class DragDropManager {
|
||||||
this.eventBus.on('header:mouseleave', (event) => {
|
this.eventBus.on('header:mouseleave', (event) => {
|
||||||
// Check if we're dragging ANY event
|
// Check if we're dragging ANY event
|
||||||
if (this.draggedEventId) {
|
if (this.draggedEventId) {
|
||||||
// Find and remove all-day event if it exists
|
// Find and remove all-day event specifically in the container
|
||||||
const allDayEvent = document.querySelector(`swp-allday-event[data-event-id="${this.draggedEventId}"]`);
|
const allDayEvent = document.querySelector(`swp-allday-container swp-allday-event[data-event-id="${this.draggedEventId}"]`);
|
||||||
if (allDayEvent) {
|
if (allDayEvent) {
|
||||||
allDayEvent.remove();
|
allDayEvent.remove();
|
||||||
// Clone i swp-day-columns tager automatisk over
|
}
|
||||||
|
|
||||||
|
// Show drag clone again
|
||||||
|
const dragClone = document.querySelector(`swp-event[data-event-id="clone-${this.draggedEventId}"]`);
|
||||||
|
if (dragClone) {
|
||||||
|
(dragClone as HTMLElement).style.display = 'block';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue