Compare commits

..
4 Commits
Author SHA1 Message Date
Benjy Cui 1e34b94d86 bump 3.7.2 2016-06-22 09:25:13 +08:00
Aaron Lampros a678437462 fix: import dom util directly, close: #108. (#110) 2016-06-22 09:20:57 +08:00
Benjy Cui a4c06c2509 bump 3.7.1 2016-06-12 09:17:48 +08:00
Jordan Stephens ff9e68cd36 ignore right button on mousedown (#107)
fix: should ignore right button on mousedown
2016-06-12 09:16:24 +08:00
2 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "rc-slider", "name": "rc-slider",
"version": "3.7.0", "version": "3.7.2",
"description": "slider ui component for react", "description": "slider ui component for react",
"keywords": [ "keywords": [
"react", "react",
+6 -5
View File
@@ -1,5 +1,5 @@
import React, { cloneElement } from 'react'; import React, { cloneElement } from 'react';
import {Dom as DomUtils} from 'rc-util'; import addEventListener from 'rc-util/lib/Dom/addEventListener';
import classNames from 'classnames'; import classNames from 'classnames';
import Track from './Track'; import Track from './Track';
import DefaultHandle from './Handle'; import DefaultHandle from './Handle';
@@ -167,6 +167,7 @@ class Slider extends React.Component {
} }
onMouseDown(e) { onMouseDown(e) {
if (e.button !== 0) { return; }
const position = getMousePosition(this.props.vertical, e); const position = getMousePosition(this.props.vertical, e);
this.onStart(position); this.onStart(position);
this.addDocumentEvents('mouse'); this.addDocumentEvents('mouse');
@@ -301,11 +302,11 @@ class Slider extends React.Component {
addDocumentEvents(type) { addDocumentEvents(type) {
if (type === 'touch') { if (type === 'touch') {
// just work for chrome iOS Safari and Android Browser // just work for chrome iOS Safari and Android Browser
this.onTouchMoveListener = DomUtils.addEventListener(document, 'touchmove', this.onTouchMove.bind(this)); this.onTouchMoveListener = addEventListener(document, 'touchmove', this.onTouchMove.bind(this));
this.onTouchUpListener = DomUtils.addEventListener(document, 'touchend', this.end.bind(this, 'touch')); this.onTouchUpListener = addEventListener(document, 'touchend', this.end.bind(this, 'touch'));
} else if (type === 'mouse') { } else if (type === 'mouse') {
this.onMouseMoveListener = DomUtils.addEventListener(document, 'mousemove', this.onMouseMove.bind(this)); this.onMouseMoveListener = addEventListener(document, 'mousemove', this.onMouseMove.bind(this));
this.onMouseUpListener = DomUtils.addEventListener(document, 'mouseup', this.end.bind(this, 'mouse')); this.onMouseUpListener = addEventListener(document, 'mouseup', this.end.bind(this, 'mouse'));
} }
} }