Skip to content

fix(circle): fix progress doesn't work correctly in safari with zoom in/out #184

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 31, 2022
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
16 changes: 8 additions & 8 deletions src/Circle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const getCircleStyle = (
strokeDasharray: `${perimeterWithoutGap}px ${perimeter}`,
strokeDashoffset: strokeDashoffset + stepSpace,
transform: `rotate(${rotateDeg + offsetDeg + positionDeg}deg)`,
transformOrigin: '50% 50%',
transformOrigin: '0 0',
transition:
'stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s',
fillOpacity: 0,
Expand Down Expand Up @@ -129,8 +129,8 @@ const Circle: React.FC<ProgressProps> = ({
key={index}
className={`${prefixCls}-circle-path`}
r={radius}
cx={VIEW_BOX_SIZE / 2}
cy={VIEW_BOX_SIZE / 2}
cx={0}
cy={0}
stroke={stroke}
strokeLinecap={strokeLinecap}
strokeWidth={strokeWidth}
Expand Down Expand Up @@ -181,8 +181,8 @@ const Circle: React.FC<ProgressProps> = ({
key={index}
className={`${prefixCls}-circle-path`}
r={radius}
cx={VIEW_BOX_SIZE / 2}
cy={VIEW_BOX_SIZE / 2}
cx={0}
cy={0}
stroke={stroke}
// strokeLinecap={strokeLinecap}
strokeWidth={strokeWidth}
Expand All @@ -199,7 +199,7 @@ const Circle: React.FC<ProgressProps> = ({
return (
<svg
className={classNames(`${prefixCls}-circle`, className)}
viewBox={`0 0 ${VIEW_BOX_SIZE} ${VIEW_BOX_SIZE}`}
viewBox={`${-VIEW_BOX_SIZE / 2} ${-VIEW_BOX_SIZE / 2} ${VIEW_BOX_SIZE} ${VIEW_BOX_SIZE}`}
style={style}
id={id}
{...restProps}
Expand All @@ -219,8 +219,8 @@ const Circle: React.FC<ProgressProps> = ({
<circle
className={`${prefixCls}-circle-trail`}
r={radius}
cx={VIEW_BOX_SIZE / 2}
cy={VIEW_BOX_SIZE / 2}
cx={0}
cy={0}
stroke={trailColor}
strokeLinecap={strokeLinecap}
strokeWidth={trailWidth || strokeWidth}
Expand Down