Improves drag and drop autoscroll behavior.

Refines the drag and drop autoscroll functionality to correctly update the position of the dragged element relative to the scrolling container.

Calculates the snapped position based on the column's bounding rectangle and scroll movement, ensuring accurate placement during autoscroll. This provides a smoother and more responsive user experience when dragging elements near the edges of the scrollable area.
This commit is contained in:
Janus Knudsen 2025-09-03 20:13:56 +02:00
parent 2083c6921e
commit b4d758b6d9
2 changed files with 29 additions and 7 deletions

View file

@ -48,6 +48,18 @@ export abstract class BaseEventRenderer implements EventRendererStrategy {
this.handleDragMove(eventId, snappedY, column, mouseOffset);
});
// Handle drag auto-scroll (when dragging near edges triggers scroll)
eventBus.on('drag:auto-scroll', (event) => {
const { eventId, snappedY } = (event as CustomEvent).detail;
if (!this.draggedClone) return;
// Update position directly using the calculated snapped position
this.draggedClone.style.top = snappedY + 'px';
// Update timestamp display
this.updateCloneTimestamp(this.draggedClone, snappedY);
});
// Handle drag end
eventBus.on('drag:end', (event) => {
const { eventId, originalElement, finalColumn, finalY } = (event as CustomEvent).detail;