Skip to content

Commit 0d5ed30

Browse files
xturskyjquense
authored andcommitted
fix: dragging is disabled if resizing is not allowed (jquense#1072) (jquense#1073)
1 parent 6c6efb3 commit 0d5ed30

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/addons/dragAndDrop/EventWrapper.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ class EventWrapper extends React.Component {
8989
return children
9090
}
9191

92-
let StartAnchor = null
93-
let EndAnchor = null
94-
9592
/*
9693
* The resizability of events depends on whether they are
9794
* allDay events and how they are displayed.
@@ -115,15 +112,7 @@ class EventWrapper extends React.Component {
115112
? !!get(event, resizableAccessor)
116113
: true
117114

118-
if (isResizable) {
119-
if (type === 'date') {
120-
StartAnchor = !continuesPrior && this.renderAnchor('Left')
121-
EndAnchor = !continuesAfter && this.renderAnchor('Right')
122-
} else {
123-
StartAnchor = !continuesPrior && this.renderAnchor('Up')
124-
EndAnchor = !continuesAfter && this.renderAnchor('Down')
125-
}
126-
115+
if (isResizable || isDraggable) {
127116
/*
128117
* props.children is the singular <Event> component.
129118
* BigCalendar positions the Event abolutely and we
@@ -135,15 +124,28 @@ class EventWrapper extends React.Component {
135124
const newProps = {
136125
onMouseDown: this.handleStartDragging,
137126
onTouchStart: this.handleStartDragging,
138-
// replace original event child with anchor-embellished child
127+
}
139128

140-
children: (
129+
if (isResizable) {
130+
// replace original event child with anchor-embellished child
131+
let StartAnchor = null
132+
let EndAnchor = null
133+
134+
if (type === 'date') {
135+
StartAnchor = !continuesPrior && this.renderAnchor('Left')
136+
EndAnchor = !continuesAfter && this.renderAnchor('Right')
137+
} else {
138+
StartAnchor = !continuesPrior && this.renderAnchor('Up')
139+
EndAnchor = !continuesAfter && this.renderAnchor('Down')
140+
}
141+
142+
newProps.children = (
141143
<div className="rbc-addons-dnd-resizable">
142144
{StartAnchor}
143145
{children.props.children}
144146
{EndAnchor}
145147
</div>
146-
),
148+
)
147149
}
148150

149151
if (

0 commit comments

Comments
 (0)