Refactors drag and drop column detection
Improves drag and drop functionality by refactoring column detection to use column bounds instead of dates. This change enhances the accuracy and efficiency of determining the target column during drag operations. It also removes redundant code and simplifies the logic in both the DragDropManager and AllDayManager.
This commit is contained in:
parent
4141bffca4
commit
6ccc071587
8 changed files with 262 additions and 377 deletions
|
|
@ -2,6 +2,8 @@
|
|||
* Type definitions for calendar events
|
||||
*/
|
||||
|
||||
import { ColumnBounds } from "../utils/ColumnDetectionUtils";
|
||||
|
||||
export interface AllDayEvent {
|
||||
id: string;
|
||||
title: string;
|
||||
|
|
@ -49,7 +51,7 @@ export interface DragStartEventPayload {
|
|||
draggedClone: HTMLElement | null;
|
||||
mousePosition: MousePosition;
|
||||
mouseOffset: MousePosition;
|
||||
column: string | null;
|
||||
columnBounds: ColumnBounds | null;
|
||||
}
|
||||
|
||||
// Drag move event payload
|
||||
|
|
@ -57,8 +59,8 @@ export interface DragMoveEventPayload {
|
|||
draggedElement: HTMLElement;
|
||||
mousePosition: MousePosition;
|
||||
mouseOffset: MousePosition;
|
||||
columnBounds: ColumnBounds | null;
|
||||
snappedY: number;
|
||||
column: string | null;
|
||||
}
|
||||
|
||||
// Drag end event payload
|
||||
|
|
@ -67,7 +69,7 @@ export interface DragEndEventPayload {
|
|||
draggedClone: HTMLElement | null;
|
||||
mousePosition: MousePosition;
|
||||
finalPosition: {
|
||||
column: string | null;
|
||||
column: ColumnBounds | null;
|
||||
snappedY: number;
|
||||
};
|
||||
target: 'swp-day-column' | 'swp-day-header' | null;
|
||||
|
|
@ -75,7 +77,7 @@ export interface DragEndEventPayload {
|
|||
|
||||
// Drag mouse enter header event payload
|
||||
export interface DragMouseEnterHeaderEventPayload {
|
||||
targetDate: string;
|
||||
targetColumn: ColumnBounds;
|
||||
mousePosition: MousePosition;
|
||||
originalElement: HTMLElement | null;
|
||||
cloneElement: HTMLElement | null;
|
||||
|
|
@ -93,8 +95,8 @@ export interface DragMouseLeaveHeaderEventPayload {
|
|||
export interface DragColumnChangeEventPayload {
|
||||
draggedElement: HTMLElement;
|
||||
draggedClone: HTMLElement | null;
|
||||
previousColumn: string | null;
|
||||
newColumn: string;
|
||||
previousColumn: ColumnBounds | null;
|
||||
newColumn: ColumnBounds;
|
||||
mousePosition: MousePosition;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue