Skip to content

Commit

Permalink
fix(DnD): selection in WeekView
Browse files Browse the repository at this point in the history
  • Loading branch information
ehahn9 committed Mar 4, 2021
1 parent 611a0ce commit 2813631
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/addons/dragAndDrop/WeekWrapper.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import PropTypes from 'prop-types'
import React from 'react'
import EventRow from '../../EventRow'
import Selection, {
getBoundsForNode,
getEventNodeFromPoint,
} from '../../Selection'
import Selection, { getBoundsForNode } from '../../Selection'
import * as dates from '../../utils/dates'
import { eventSegments } from '../../utils/eventLevels'
import { getSlotAtX, pointInBox } from '../../utils/selection'
Expand Down Expand Up @@ -162,17 +159,17 @@ class WeekWrapper extends React.Component {
selector.on('beforeSelect', point => {
const { isAllDay } = this.props
const { action } = this.context.draggable.dragAndDropAction
const eventNode = getEventNodeFromPoint(node, point)
const bounds = getBoundsForNode(node)

// eventOffsetLeft is distance from the left of the event to the initial
// mouseDown position. We need this later to compute the new top of the
// event during move operations, since the final location is really a
// delta from this point. note: if we want to DRY this with
// EventContainerWrapper, probably better just to capture the mouseDown
// point here and do the placement computation in handleMove()...
this.eventOffsetLeft = point.x - getBoundsForNode(eventNode).left
this.eventOffsetLeft = point.x - bounds.left

const isInBox = pointInBox(getBoundsForNode(node), point)
const isInBox = pointInBox(bounds, point)
return (
action === 'move' || (action === 'resize' && (!isAllDay || isInBox))
)
Expand Down

0 comments on commit 2813631

Please sign in to comment.