Skip to content

Commit

Permalink
feat: circle组件增加beginAngle (#530)
Browse files Browse the repository at this point in the history
Co-authored-by: zhixia <[email protected]>
  • Loading branch information
Chitanda60 and zhixia authored Jun 21, 2023
1 parent ad395f1 commit 3fb0854
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/vantui/src/circle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function Circle(props: CircleProps) {
color = '#1989fa',
strokeWidth = 4,
clockwise = true,
beginAngle = BEGIN_ANGLE,
style,
className,
children,
Expand Down Expand Up @@ -147,9 +148,9 @@ export function Circle(props: CircleProps) {
// 结束角度
const progress = PERIMETER * (formatValue / 100)
const endAngle = clockwise
? BEGIN_ANGLE + progress
: 3 * Math.PI - (BEGIN_ANGLE + progress)
presetCanvas(context, ref.current.hoverColor, BEGIN_ANGLE, endAngle)
? beginAngle + progress
: 3 * Math.PI - (beginAngle + progress)
presetCanvas(context, ref.current.hoverColor, beginAngle, endAngle)
},
[clockwise, presetCanvas],
)
Expand Down
1 change: 1 addition & 0 deletions packages/vantui/types/circle.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface CircleProps extends ViewProps {
color?: string | Record<string, string>
strokeWidth?: number
clockwise?: boolean
beginAngle?: number
children?: ReactNode
}

Expand Down

0 comments on commit 3fb0854

Please sign in to comment.