Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

🐛 fix line progress percentage #94

Merged
merged 1 commit into from
Dec 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/Line.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,20 @@ const Line: React.FC<ProgressProps> = ({
fillOpacity="0"
/>
{percentList.map((ptg, index) => {
let dashPercent = 1;
switch (strokeLinecap) {
case 'round':
dashPercent = 1 - strokeWidth / 100;
break;
case 'square':
dashPercent = 1 - strokeWidth / 2 / 100;
break;
default:
dashPercent = 1;
break;
}
const pathStyle = {
strokeDasharray: `${ptg}px, 100px`,
strokeDasharray: `${ptg * dashPercent}px, 100px`,
strokeDashoffset: `-${stackPtg}px`,
transition:
transition ||
Expand Down