Skip to content

Commit

Permalink
πŸ› fix line progress percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
preper committed Dec 29, 2020
1 parent e4a262b commit 5fe2811
Showing 1 changed file with 13 additions and 1 deletion.
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

0 comments on commit 5fe2811

Please sign in to comment.