Skip to content

Commit

Permalink
Merge pull request #431 from Tencent/huanyue2019/feature/web/progressFix
Browse files Browse the repository at this point in the history
fix progress render incorrect when percentage less than 5%
  • Loading branch information
chaishi authored Feb 17, 2022
2 parents aa1e554 + 8e4d5b4 commit bb925a3
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 61 deletions.
28 changes: 15 additions & 13 deletions src/progress/progress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default Vue.extend({
},
strokeDashArr(): string {
const radius = this.diameter / 2;
const perimeter = Math.PI * 2 * (radius - this.circleStrokeWidth);
const perimeter = Math.PI * 2 * radius;
const percent = this.percentage / 100;
return `${perimeter * percent} ${perimeter * (1 - percent)}`;
},
Expand Down Expand Up @@ -210,18 +210,20 @@ export default Vue.extend({
class={`${name}__circle-outer`}
style={this.circleStrokeStyle}
/>
<circle
cx={this.rPoints}
cy={this.rPoints}
r={this.radius}
stroke-width={this.circleStrokeWidth}
fill="none"
stroke-linecap="round"
class={`${name}__circle-inner`}
transform={`matrix(0,-1,1,0,0,${this.diameter})`}
stroke-dasharray={this.strokeDashArr}
style={this.circlePathStyle}
/>
{this.percentage > 0 && (
<circle
cx={this.rPoints}
cy={this.rPoints}
r={this.radius}
stroke-width={this.circleStrokeWidth}
fill="none"
stroke-linecap="round"
class={`${name}__circle-inner`}
transform={`matrix(0,-1,1,0,0,${this.diameter})`}
stroke-dasharray={this.strokeDashArr}
style={this.circlePathStyle}
/>
)}
</svg>
</div>
)}
Expand Down
Loading

0 comments on commit bb925a3

Please sign in to comment.