Skip to content

Commit

Permalink
Customize drag from outside event's length
Browse files Browse the repository at this point in the history
  • Loading branch information
ducfilan committed Nov 21, 2024
1 parent 9f082fb commit 0182d29
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/addons/dragAndDrop/EventContainerWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand All @@ -152,8 +155,8 @@ class EventContainerWrapper extends React.Component {
parent,
Math.min(
draggedEl.offsetTop -
parent.offsetHeight +
draggedEl.offsetHeight,
parent.offsetHeight +
draggedEl.offsetHeight,
parent.scrollHeight
)
)
Expand Down

0 comments on commit 0182d29

Please sign in to comment.