Improves drag and drop functionality

Refactors drag and drop logic to use the dragged clone consistently, fixing issues with event handling and element manipulation during drag operations.
Also includes a fix where the original element is removed after a drag is completed.
Adds column bounds cache update after drag operations for improved column detection.
This commit is contained in:
Janus C. H. Knudsen 2025-09-30 00:13:52 +02:00
parent 83e01f9cb7
commit 5417a2b6b1
7 changed files with 50 additions and 45 deletions

View file

@ -57,6 +57,7 @@ export interface DragStartEventPayload {
// Drag move event payload
export interface DragMoveEventPayload {
draggedElement: HTMLElement;
draggedClone: HTMLElement;
mousePosition: MousePosition;
mouseOffset: MousePosition;
columnBounds: ColumnBounds | null;
@ -65,7 +66,7 @@ export interface DragMoveEventPayload {
// Drag end event payload
export interface DragEndEventPayload {
draggedElement: HTMLElement;
originalElement: HTMLElement;
draggedClone: HTMLElement | null;
mousePosition: MousePosition;
finalPosition: {
@ -80,7 +81,7 @@ export interface DragMouseEnterHeaderEventPayload {
targetColumn: ColumnBounds;
mousePosition: MousePosition;
originalElement: HTMLElement | null;
cloneElement: HTMLElement;
draggedClone: HTMLElement;
}
// Drag mouse leave header event payload
@ -88,12 +89,12 @@ export interface DragMouseLeaveHeaderEventPayload {
targetDate: string | null;
mousePosition: MousePosition;
originalElement: HTMLElement| null;
cloneElement: HTMLElement| null;
draggedClone: HTMLElement| null;
}
// Drag column change event payload
export interface DragColumnChangeEventPayload {
draggedElement: HTMLElement;
originalElement: HTMLElement;
draggedClone: HTMLElement | null;
previousColumn: ColumnBounds | null;
newColumn: ColumnBounds;