Skip to content

Commit

Permalink
feat: drag auto scroll as default behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitRDesai committed Feb 10, 2023
1 parent 206b7d2 commit c4e78d8
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 123 deletions.
8 changes: 5 additions & 3 deletions src/addons/dragAndDrop/EventContainerWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,13 @@ class EventContainerWrapper extends React.Component {
const { dragAndDropAction } = this.context.draggable

if (dragAndDropAction.action === 'move') {
if (this.context.draggable.enableDragAutoScroll)
this.updateParentScroll(parent, node)
this.updateParentScroll(parent, node)
this.handleMove(box, bounds)
}
if (dragAndDropAction.action === 'resize') this.handleResize(box, bounds)
if (dragAndDropAction.action === 'resize') {
this.updateParentScroll(parent, node)
this.handleResize(box, bounds)
}
})

selector.on('dropFromOutside', (point) => {
Expand Down
3 changes: 0 additions & 3 deletions src/addons/dragAndDrop/withDragAndDrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export default function withDragAndDrop(Calendar) {

selectable: PropTypes.oneOf([true, false, 'ignoreEvents']),
resizable: PropTypes.bool,

enableDragAutoScroll: PropTypes.bool,
}

static defaultProps = {
Expand Down Expand Up @@ -63,7 +61,6 @@ export default function withDragAndDrop(Calendar) {
draggableAccessor: this.props.draggableAccessor,
resizableAccessor: this.props.resizableAccessor,
dragAndDropAction: this.state,
enableDragAutoScroll: this.props.enableDragAutoScroll,
},
}
}
Expand Down
11 changes: 0 additions & 11 deletions stories/DragAndDrop.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,3 @@ WithCustomEventWrapper.args = {
eventWrapper: customComponents.eventWrapper,
},
}

export const WithAutoScroll = Template.bind({})
WithAutoScroll.storyName = 'draggable with auto scroll'
WithAutoScroll.args = {
defaultDate: new Date(),
defaultView: Views.WEEK,
events,
onEventDrop: action('event dropped'),
onEventResize: action('event resized'),
enableDragAutoScroll: true,
}
10 changes: 0 additions & 10 deletions stories/addons/dragAndDrop/props/API.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,3 @@ The <LinkTo kind="addons-drag-and-drop-props" story="resizable">resizable</LinkT
Determines if an event is resizable.

**Note:** `resizable` events must also be draggable. You cannot resize an event with a <LinkTo kind="addons-drag-and-drop-props" story="draggable-accessor">draggableAccessor</LinkTo> prop of `false`.

### enableDragAutoScroll

- type: `boolean`
- default: `false`
- <LinkTo kind="addons-drag-and-drop-props" story="auto-scroll">
Example
</LinkTo>

It is used to enable auto scroll when dragging an event.
9 changes: 0 additions & 9 deletions stories/addons/dragAndDrop/props/autoScroll.mdx

This file was deleted.

22 changes: 0 additions & 22 deletions stories/addons/dragAndDrop/props/autoScroll.stories.js

This file was deleted.

65 changes: 0 additions & 65 deletions stories/demos/exampleCode/autoScroll.js

This file was deleted.

0 comments on commit c4e78d8

Please sign in to comment.