From afa84683fc6d3cd637013f08eac6d7bc1314c254 Mon Sep 17 00:00:00 2001 From: Old_dream Date: Thu, 10 Mar 2022 20:03:29 +0800 Subject: [PATCH] fix: Correct resizing event bug in Week & Day (#2143) Co-authored-by: huangyuning --- examples/demos/dnd.js | 1 - src/addons/dragAndDrop/EventContainerWrapper.js | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/demos/dnd.js b/examples/demos/dnd.js index a3a4573e0..526bd7603 100644 --- a/examples/demos/dnd.js +++ b/examples/demos/dnd.js @@ -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 } diff --git a/src/addons/dragAndDrop/EventContainerWrapper.js b/src/addons/dragAndDrop/EventContainerWrapper.js index 98ec7d61c..acc2f938a 100644 --- a/src/addons/dragAndDrop/EventContainerWrapper.js +++ b/src/addons/dragAndDrop/EventContainerWrapper.js @@ -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) @@ -179,7 +184,6 @@ class EventContainerWrapper extends React.Component { handleInteractionEnd = () => { const { resource } = this.props const { event } = this.state - this.reset() this.context.draggable.onEnd({