Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions lib/DraggableCore.es6
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,18 @@ export default class DraggableCore extends React.Component {
this.props.onDrag(e, coreEvent);
};

onMouseDown: EventHandler = (e) => {
dragEventFor = eventsFor.mouse; // on touchscreen laptops we could switch back to mouse

return this.handleDragStart(e);
};

onMouseUp: EventHandler = (e) => {
dragEventFor = eventsFor.mouse;

return this.handleDragStop(e);
};

// Same as onMouseDown (start drag), but now consider this a touch device.
onTouchStart: EventHandler = (e) => {
// We're on a touch device now, so change the event handlers
Expand All @@ -415,9 +427,9 @@ export default class DraggableCore extends React.Component {

// Note: mouseMove handler is attached to document so it will still function
// when the user drags quickly and leaves the bounds of the element.
onMouseDown: this.handleDragStart,
onMouseDown: this.onMouseDown,
onTouchStart: this.onTouchStart,
onMouseUp: this.handleDragStop,
onMouseUp: this.onMouseUp,
onTouchEnd: this.onTouchEnd
});
}
Expand Down