Enhances event drag and resize functionality
Improves event dragging by tracking the source column and using the updated event data for re-rendering affected columns. Also, enhances event resizing by updating the event data and re-rendering the column to recalculate stacking/grouping. Uses snap interval as minimum duration when resizing.
This commit is contained in:
parent
e83753a7d2
commit
ecb1729c28
4 changed files with 154 additions and 7 deletions
|
|
@ -40,6 +40,7 @@ export class DragDropManager {
|
|||
private draggedElement!: HTMLElement | null;
|
||||
private draggedClone!: HTMLElement | null;
|
||||
private currentColumnBounds: ColumnBounds | null = null;
|
||||
private initialColumnBounds: ColumnBounds | null = null; // Track source column
|
||||
private isDragStarted = false;
|
||||
|
||||
// Hover state
|
||||
|
|
@ -231,8 +232,9 @@ export class DragDropManager {
|
|||
this.draggedElement.style.zIndex = '9999';
|
||||
}
|
||||
|
||||
// Detect current column
|
||||
// Detect current column and save as initial source column
|
||||
this.currentColumnBounds = ColumnDetectionUtils.getColumnBounds(currentPosition);
|
||||
this.initialColumnBounds = this.currentColumnBounds; // Save source column
|
||||
|
||||
// Cast to BaseSwpEventElement and create clone (works for both SwpEventElement and SwpAllDayEventElement)
|
||||
const originalElement = this.draggedElement as BaseSwpEventElement;
|
||||
|
|
@ -344,8 +346,9 @@ export class DragDropManager {
|
|||
const dragEndPayload: DragEndEventPayload = {
|
||||
originalElement: this.draggedElement,
|
||||
draggedClone: this.draggedClone,
|
||||
sourceColumn: this.initialColumnBounds, // Where drag started
|
||||
mousePosition,
|
||||
finalPosition: { column, snappedY },
|
||||
finalPosition: { column, snappedY }, // Where drag ended
|
||||
target: dropTarget
|
||||
};
|
||||
this.eventBus.emit('drag:end', dragEndPayload);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue