mirror of
https://github.com/kevinsqi/react-circular-progressbar.git
synced 2026-01-18 15:55:06 +00:00
Merge pull request #20 from slaweet/patch-1
Keep progress bar within 0 and 100
This commit is contained in:
commit
8baa206378
@ -44,7 +44,7 @@ class CircularProgressbar extends React.Component {
|
||||
const diameter = Math.PI * 2 * radius;
|
||||
const progressStyle = {
|
||||
strokeDasharray: `${diameter}px ${diameter}px`,
|
||||
strokeDashoffset: `${((100 - this.state.percentage) / 100 * diameter)}px`,
|
||||
strokeDashoffset: `${((100 - Math.min(Math.max(this.state.percentage, 0), 100)) / 100 * diameter)}px`,
|
||||
};
|
||||
|
||||
const classForPercentage = this.props.classForPercentage ? this.props.classForPercentage(this.props.percentage) : '';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user