Skip to content

Commit

Permalink
fix: Correct resizing event bug in Week & Day (jquense#2143)
Browse files Browse the repository at this point in the history
Co-authored-by: huangyuning <huangyuning@vv.cn>
  • Loading branch information
OldDream and huangyuning committed Mar 10, 2022
1 parent 89dd0fb commit afa8468
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion examples/demos/dnd.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class Dnd extends React.Component {

resizeEvent = ({ event, start, end }) => {
const { events } = this.state

const nextEvents = events.map(existingEvent => {
return existingEvent.id == event.id
? { ...existingEvent, start, end }
Expand Down
12 changes: 8 additions & 4 deletions src/addons/dragAndDrop/EventContainerWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,20 @@ class EventContainerWrapper extends React.Component {
selector.on('select', point => {
const bounds = getBoundsForNode(node)
isBeingDragged = false
if (!this.state.event || !pointInColumn(bounds, point)) return
this.handleInteractionEnd()
const { dragAndDropAction } = this.context.draggable
if (dragAndDropAction.action === 'resize') {
this.handleInteractionEnd()
} else if (!this.state.event || !pointInColumn(bounds, point)) {
return
} else {
this.handleInteractionEnd()
}
})

selector.on('click', () => {
if (isBeingDragged) this.reset()
this.context.draggable.onEnd(null)
})

selector.on('reset', () => {
this.reset()
this.context.draggable.onEnd(null)
Expand All @@ -179,7 +184,6 @@ class EventContainerWrapper extends React.Component {
handleInteractionEnd = () => {
const { resource } = this.props
const { event } = this.state

this.reset()

this.context.draggable.onEnd({
Expand Down

0 comments on commit afa8468

Please sign in to comment.