@@ -118,9 +118,11 @@ class EventContainerWrapper extends React.Component {
118118 boundaryBox
119119 )
120120
121+ const end = this . _calculateDnDEnd ( start )
122+
121123 this . context . draggable . onDropFromOutside ( {
122124 start,
123- end : slotMetrics . nextSlot ( start ) ,
125+ end,
124126 allDay : false ,
125127 resource,
126128 } )
@@ -133,11 +135,25 @@ class EventContainerWrapper extends React.Component {
133135 { y : point . y , x : point . x } ,
134136 bounds
135137 )
136- const end = slotMetrics . nextSlot ( start )
138+ const end = this . _calculateDnDEnd ( start )
137139 const event = this . context . draggable . dragFromOutsideItem ( )
138140 this . update ( event , slotMetrics . getRange ( start , end , false , true ) )
139141 }
140142
143+ _calculateDnDEnd = ( start ) => {
144+ const { accessors, slotMetrics, localizer } = this . props
145+ const event = this . context . draggable . dragFromOutsideItem ( )
146+ const { duration : eventDuration } = eventTimes ( event , accessors , localizer )
147+
148+ let end = slotMetrics . nextSlot ( start )
149+ const eventHasDuration = ! isNaN ( eventDuration )
150+ if ( eventHasDuration ) {
151+ const eventEndSlot = localizer . add ( start , eventDuration , 'milliseconds' )
152+ end = new Date ( Math . max ( eventEndSlot , end ) )
153+ }
154+ return end
155+ }
156+
141157 updateParentScroll = ( parent , node ) => {
142158 setTimeout ( ( ) => {
143159 const draggedEl = qsa ( node , '.rbc-addons-dnd-drag-preview' ) [ 0 ]
@@ -152,8 +168,8 @@ class EventContainerWrapper extends React.Component {
152168 parent ,
153169 Math . min (
154170 draggedEl . offsetTop -
155- parent . offsetHeight +
156- draggedEl . offsetHeight ,
171+ parent . offsetHeight +
172+ draggedEl . offsetHeight ,
157173 parent . scrollHeight
158174 )
159175 )
0 commit comments