Skip to content

Commit

Permalink
removeEvent on Mouseup and before addEvent (#306)
Browse files Browse the repository at this point in the history
* removeEvent on Mouseup and before addEvent

* no need to clear touch event
  • Loading branch information
Robin-front authored and paranoidjk committed Oct 25, 2017
1 parent 76d4cf3 commit 45975c4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/common/createSlider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export default function createSlider(Component) {
this.dragOffset = position - handlePosition;
position = handlePosition;
}
this.removeDocumentEvents();
this.onStart(position);
this.addDocumentMouseEvents();
utils.pauseEvent(e);
Expand Down Expand Up @@ -161,6 +162,10 @@ export default function createSlider(Component) {
/* eslint-enable no-unused-expressions */
}

onMouseUp = () => {
this.removeDocumentEvents();
}

onMouseMove = (e) => {
if (!this.sliderRef) {
this.onEnd();
Expand Down Expand Up @@ -263,6 +268,7 @@ export default function createSlider(Component) {
className={sliderClassName}
onTouchStart={disabled ? noop : this.onTouchStart}
onMouseDown={disabled ? noop : this.onMouseDown}
onMouseUp={disabled ? noop : this.onMouseUp}
onKeyDown={disabled ? noop : this.onKeyDown}
onFocus={disabled ? noop : this.onFocus}
onBlur={disabled ? noop : this.onBlur}
Expand Down

0 comments on commit 45975c4

Please sign in to comment.