这个很简单,但我有点迷路了。
如何使文本位于圆圈的中间(垂直和水平)?或中间的所有内容Svg
(然后文本将在圆圈的中间)
const size = width < height ? width - 32 : height - 16
const strokeWidth = 25
const radius = (size - strokeWidth) / 2
const circunference = radius * 2 * Math.PI
return (
<Svg width={width} height={size}>
<Text>
Hey
</Text>
<Circle
stroke="#2162cc"
fill="none"
cx={size / 2}
cy={size / 2}
r={radius}
strokeDasharray={`${circunference} ${circunference}`}
{...{ strokeWidth, strokeDashoffset }}
/>
</Svg>
)