Improves all-day event drag and drop

Addresses issues with all-day event duration calculation and positioning during drag and drop.

- Uses `differenceInCalendarDays` to correctly calculate event duration across timezone and DST boundaries.
- Preserves the original event time when moving events to a different day.
- Snaps dragged event to the top of the target time slot.
This commit is contained in:
Janus C. H. Knudsen 2025-10-03 19:09:44 +02:00
parent 53cf097a47
commit 4fea01c76b
3 changed files with 26 additions and 5 deletions

View file

@ -367,7 +367,11 @@ export class DragDropManager {
* Optimized snap position calculation using PositionUtils
*/
private calculateSnapPosition(mouseY: number, column: ColumnBounds): number {
const snappedY = PositionUtils.getPositionFromCoordinate(mouseY, column);
// Calculate where the event top would be (accounting for mouse offset)
const eventTopY = mouseY - this.mouseOffset.y;
// Snap the event top position, not the mouse position
const snappedY = PositionUtils.getPositionFromCoordinate(eventTopY, column);
return Math.max(0, snappedY);
}