Updates event data after drag and drop
Updates event start and end times in the dataset after a successful drag and drop operation. This ensures the event element reflects the new time position. Also resets the z-index of the dropped element if no overlaps are detected, keeping the element's original appearance.
This commit is contained in:
parent
69f4a71062
commit
5cffc233c5
1 changed files with 9 additions and 1 deletions
|
|
@ -390,6 +390,12 @@ export abstract class BaseEventRenderer implements EventRendererStrategy {
|
|||
this.draggedClone.style.userSelect = '';
|
||||
// Behold z-index hvis det er et stacked event
|
||||
|
||||
// Update dataset with new times after successful drop
|
||||
const newEvent = this.elementToCalendarEventWithNewPosition(this.draggedClone, finalColumn);
|
||||
if (newEvent) {
|
||||
this.draggedClone.dataset.start = newEvent.start.toISOString();
|
||||
this.draggedClone.dataset.end = newEvent.end.toISOString();
|
||||
}
|
||||
|
||||
// Detect overlaps with other events in the target column and reposition if needed
|
||||
this.handleDragDropOverlaps(this.draggedClone, finalColumn);
|
||||
|
|
@ -498,8 +504,10 @@ export abstract class BaseEventRenderer implements EventRendererStrategy {
|
|||
// Re-render affected events with overlap handling
|
||||
const affectedEvents = [droppedEvent, ...overlappingEvents];
|
||||
this.new_handleEventOverlaps(affectedEvents, eventsLayer);
|
||||
} else {
|
||||
// Reset z-index for non-overlapping events
|
||||
droppedElement.style.zIndex = '';
|
||||
}
|
||||
// If no overlaps, the dropped element stays as is
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue