fix: the key of marks could be negative

This commit is contained in:
Benjy Cui
2015-11-18 18:27:37 +08:00
parent ee71955e14
commit a7c2319949
3 changed files with 9 additions and 14 deletions
+1 -7
View File
@@ -17,13 +17,7 @@ const Marks = ({className, marks, included, upperBound, lowerBound, max, min}) =
});
const style = { width: markWidth };
if (point === marksCount - 1) {
style.right = -unit / 4 + '%';
} else if (point === 0) {
style.left = -unit / 4 + '%';
} else {
style.left = (point - min) / range * 100 - unit / 4 + '%';
}
style.left = (point - min) / range * 100 - unit / 4 + '%';
return (<span className={markClassName} style={style} key={point}>
{marks[point]}