Skip to content

Commit

Permalink
Merge pull request jquense#1879 from ehahn9/fix1819
Browse files Browse the repository at this point in the history
fix(DnD): selection in WeekView
  • Loading branch information
ehahn9 authored Mar 4, 2021
2 parents 611a0ce + 2813631 commit e10fa28
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 e10fa28

Please sign in to comment.