Improves drag and drop conversion behavior

Resets scroll state and stops edge scrolling when a drag event converts between all-day and timed events, preventing unexpected scrolling behavior during conversion.
This commit is contained in:
Janus C. H. Knudsen 2025-10-13 22:17:17 +02:00
parent 3fd42f1f9b
commit 1d04f0ce0a
3 changed files with 23 additions and 1 deletions

View file

@ -143,6 +143,19 @@ export class DragDropManager {
console.log('🛑 DragDropManager: Edge-scroll stopped');
});
// Reset scrollDeltaY when event converts (new clone created)
this.eventBus.on('drag:mouseenter-header', () => {
console.log('🔄 DragDropManager: Event converting to all-day - resetting scrollDeltaY');
this.scrollDeltaY = 0;
this.lastScrollTop = 0;
});
this.eventBus.on('drag:mouseenter-column', () => {
console.log('🔄 DragDropManager: Event converting to timed - resetting scrollDeltaY');
this.scrollDeltaY = 0;
this.lastScrollTop = 0;
});
}
private handleGridRendered(event: CustomEvent) {
this.scrollableContent = document.querySelector('swp-scrollable-content');

View file

@ -60,6 +60,16 @@ export class EdgeScrollManager {
this.eventBus.on('drag:end', () => this.stopDrag());
this.eventBus.on('drag:cancelled', () => this.stopDrag());
// Stop scrolling when event converts to/from all-day
this.eventBus.on('drag:mouseenter-header', () => {
console.log('🔄 EdgeScrollManager: Event converting to all-day - stopping scroll');
this.stopDrag();
});
this.eventBus.on('drag:mouseenter-column', () => {
this.startDrag();
});
}
private startDrag(): void {