File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -410,10 +410,15 @@ function getTotalTime(date: Date) {
410
410
function createEvent() {
411
411
const hoveredDay = getDateFromX (mousePosition .value .x );
412
412
413
+ // When creating an event, we fudge the initial mouse position so that
414
+ // the start of the event is always at the beginning of the hovered interval
415
+ const effectiveMouseY = floorToNearestInterval (mousePosition .value .y );
416
+
413
417
let start = getDateFromY (
414
418
hoveredDay ,
415
- floorToNearestInterval ( mousePosition . value . y )
419
+ effectiveMouseY
416
420
);
421
+
417
422
if (isAfter (start , endOfDay (hoveredDay ))) {
418
423
return ;
419
424
}
@@ -423,7 +428,7 @@ function createEvent() {
423
428
description: props .defaultEventProperties ?.description ,
424
429
color: props .defaultEventProperties ?.color ?? " #2196f3" ,
425
430
startDate: start ,
426
- endDate: addMinutes ( start , props . intervalMinutes ) ,
431
+ endDate: start ,
427
432
nOfPreviousConcurrentEvents: 0 ,
428
433
totalConcurrentEvents: 0 ,
429
434
left: 0 ,
@@ -436,7 +441,7 @@ function createEvent() {
436
441
initialEventState: { ... event },
437
442
handle: " bottom" ,
438
443
x: mousePosition .value .x ,
439
- y: mousePosition . value . y + props . intervalHeight ,
444
+ y: effectiveMouseY ,
440
445
};
441
446
creatingEvent = true ;
442
447
isDragging = true ;
You can’t perform that action at this time.
0 commit comments