Skip to content

Commit

Permalink
fix: dragging is disabled if resizing is not allowed (#1072) (#1073)
Browse files Browse the repository at this point in the history
  • Loading branch information
xtursky authored and jquense committed Nov 7, 2018
1 parent 6c6efb3 commit 0d5ed30
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions src/addons/dragAndDrop/EventWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@ class EventWrapper extends React.Component {
return children
}

let StartAnchor = null
let EndAnchor = null

/*
* The resizability of events depends on whether they are
* allDay events and how they are displayed.
Expand All @@ -115,15 +112,7 @@ class EventWrapper extends React.Component {
? !!get(event, resizableAccessor)
: true

if (isResizable) {
if (type === 'date') {
StartAnchor = !continuesPrior && this.renderAnchor('Left')
EndAnchor = !continuesAfter && this.renderAnchor('Right')
} else {
StartAnchor = !continuesPrior && this.renderAnchor('Up')
EndAnchor = !continuesAfter && this.renderAnchor('Down')
}

if (isResizable || isDraggable) {
/*
* props.children is the singular <Event> component.
* BigCalendar positions the Event abolutely and we
Expand All @@ -135,15 +124,28 @@ class EventWrapper extends React.Component {
const newProps = {
onMouseDown: this.handleStartDragging,
onTouchStart: this.handleStartDragging,
// replace original event child with anchor-embellished child
}

children: (
if (isResizable) {
// replace original event child with anchor-embellished child
let StartAnchor = null
let EndAnchor = null

if (type === 'date') {
StartAnchor = !continuesPrior && this.renderAnchor('Left')
EndAnchor = !continuesAfter && this.renderAnchor('Right')
} else {
StartAnchor = !continuesPrior && this.renderAnchor('Up')
EndAnchor = !continuesAfter && this.renderAnchor('Down')
}

newProps.children = (
<div className="rbc-addons-dnd-resizable">
{StartAnchor}
{children.props.children}
{EndAnchor}
</div>
),
)
}

if (
Expand Down

0 comments on commit 0d5ed30

Please sign in to comment.