Skip to content

Commit e10fa28

Browse files
authored
Merge pull request jquense#1879 from ehahn9/fix1819
fix(DnD): selection in WeekView
2 parents 611a0ce + 2813631 commit e10fa28

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/addons/dragAndDrop/WeekWrapper.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import PropTypes from 'prop-types'
22
import React from 'react'
33
import EventRow from '../../EventRow'
4-
import Selection, {
5-
getBoundsForNode,
6-
getEventNodeFromPoint,
7-
} from '../../Selection'
4+
import Selection, { getBoundsForNode } from '../../Selection'
85
import * as dates from '../../utils/dates'
96
import { eventSegments } from '../../utils/eventLevels'
107
import { getSlotAtX, pointInBox } from '../../utils/selection'
@@ -162,17 +159,17 @@ class WeekWrapper extends React.Component {
162159
selector.on('beforeSelect', point => {
163160
const { isAllDay } = this.props
164161
const { action } = this.context.draggable.dragAndDropAction
165-
const eventNode = getEventNodeFromPoint(node, point)
162+
const bounds = getBoundsForNode(node)
166163

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

175-
const isInBox = pointInBox(getBoundsForNode(node), point)
172+
const isInBox = pointInBox(bounds, point)
176173
return (
177174
action === 'move' || (action === 'resize' && (!isAllDay || isInBox))
178175
)

0 commit comments

Comments
 (0)