diff --git a/src/addons/dragAndDrop/EventContainerWrapper.js b/src/addons/dragAndDrop/EventContainerWrapper.js index 583da4077..5f59accc9 100644 --- a/src/addons/dragAndDrop/EventContainerWrapper.js +++ b/src/addons/dragAndDrop/EventContainerWrapper.js @@ -127,14 +127,17 @@ class EventContainerWrapper extends React.Component { } handleDragOverFromOutside = (point, bounds) => { - const { slotMetrics } = this.props + const { accessors, slotMetrics, localizer } = this.props const start = slotMetrics.closestSlotFromPoint( { y: point.y, x: point.x }, bounds ) - const end = slotMetrics.nextSlot(start) const event = this.context.draggable.dragFromOutsideItem() + const { duration: eventDuration } = eventTimes(event, accessors, localizer) + const eventEndSlot = localizer.add(start, eventDuration, 'milliseconds') + const nextSlot = slotMetrics.nextSlot(start) + const end = new Date(Math.max(eventEndSlot, nextSlot)) this.update(event, slotMetrics.getRange(start, end, false, true)) } @@ -152,8 +155,8 @@ class EventContainerWrapper extends React.Component { parent, Math.min( draggedEl.offsetTop - - parent.offsetHeight + - draggedEl.offsetHeight, + parent.offsetHeight + + draggedEl.offsetHeight, parent.scrollHeight ) )