Compare commits

...
9 Commits
Author SHA1 Message Date
Benjy Cui 80d4ee4794 bump 3.7.4 2016-07-11 09:55:12 +08:00
Benjy Cui e2504d99fe fix: should calc cloest point correctly, close: #116 2016-07-11 09:53:38 +08:00
Benjy Cui d4ae5a5298 deps: update 2016-07-11 09:48:44 +08:00
Benjy Cui ce755ecb4b bump 3.7.3 to publish website 2016-06-29 16:23:00 +08:00
Benjy Cui 9bc56e993d chore: update demo 2016-06-29 16:22:01 +08:00
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
3 changed files with 19 additions and 15 deletions
+4 -1
View File
@@ -28,8 +28,11 @@ const CustomizedSlider = React.createClass({
value: value,
});
},
onAfterChange: function(value) {
console.log(value);
},
render: function() {
return <Slider value={this.state.value} onChange={this.onSliderChange} />;
return <Slider value={this.state.value} onChange={this.onSliderChange} onAfterChange={this.onAfterChange} />;
},
});
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "rc-slider",
"version": "3.7.0",
"version": "3.7.4",
"description": "slider ui component for react",
"keywords": [
"react",
@@ -42,17 +42,17 @@
"pre-commit": "1.x",
"rc-server": "3.x",
"rc-tools": "4.x",
"react": "~0.14.0",
"react-addons-test-utils": "^0.14.0",
"react-dom": "~0.14.0"
"react": "^15.2.1",
"react-addons-test-utils": "^15.2.1",
"react-dom": "^15.2.1"
},
"pre-commit": [
"lint"
],
"dependencies": {
"classnames": "^2.2.1",
"rc-tooltip": "3.x",
"rc-util": "3.x",
"warning": "^2.1.0"
"classnames": "^2.2.5",
"rc-tooltip": "^3.4.2",
"rc-util": "^3.2.1",
"warning": "^3.0.0"
}
}
+7 -6
View File
@@ -1,5 +1,5 @@
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 Track from './Track';
import DefaultHandle from './Handle';
@@ -167,6 +167,7 @@ class Slider extends React.Component {
}
onMouseDown(e) {
if (e.button !== 0) { return; }
const position = getMousePosition(this.props.vertical, e);
this.onStart(position);
this.addDocumentEvents('mouse');
@@ -269,7 +270,7 @@ class Slider extends React.Component {
const points = Object.keys(marks).map(parseFloat);
if (step !== null) {
const closestStep = Math.round(val / step) * step;
const closestStep = (Math.round((val - min) / step) * step) + min;
points.push(closestStep);
}
@@ -301,11 +302,11 @@ class Slider extends React.Component {
addDocumentEvents(type) {
if (type === 'touch') {
// just work for chrome iOS Safari and Android Browser
this.onTouchMoveListener = DomUtils.addEventListener(document, 'touchmove', this.onTouchMove.bind(this));
this.onTouchUpListener = DomUtils.addEventListener(document, 'touchend', this.end.bind(this, 'touch'));
this.onTouchMoveListener = addEventListener(document, 'touchmove', this.onTouchMove.bind(this));
this.onTouchUpListener = addEventListener(document, 'touchend', this.end.bind(this, 'touch'));
} else if (type === 'mouse') {
this.onMouseMoveListener = DomUtils.addEventListener(document, 'mousemove', this.onMouseMove.bind(this));
this.onMouseUpListener = DomUtils.addEventListener(document, 'mouseup', this.end.bind(this, 'mouse'));
this.onMouseMoveListener = addEventListener(document, 'mousemove', this.onMouseMove.bind(this));
this.onMouseUpListener = addEventListener(document, 'mouseup', this.end.bind(this, 'mouse'));
}
}