Skip to content

Commit

Permalink
[fixed] ProgressBar percentage issue when stacked
Browse files Browse the repository at this point in the history
Using stacked ProgressBar with a maximum superior to 100 could lead to
rounding issues that made the bar incomplete.

See issue react-bootstrap#396 for mor details on the error
  • Loading branch information
YannPl committed Apr 17, 2015
1 parent f167c13 commit 276c2bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ProgressBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const ProgressBar = React.createClass({
},

getPercentage(now, min, max) {
return Math.ceil((now - min) / (max - min) * 100);
let roundPrecision = 1000;
return Math.round(((now - min) / (max - min) * 100) * roundPrecision) / roundPrecision;
},

render() {
Expand Down

0 comments on commit 276c2bc

Please sign in to comment.