/
CircleSvg.tsx
30 lines (29 loc) · 873 Bytes
/
CircleSvg.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React from 'react'
import { animated } from '@react-spring/web'
import { CircleProps } from './types'
// import { useNodeMouseHandlers } from './hooks'
export const CircleSvg = <RawDatum,>({
node,
style,
onMouseEnter,
onMouseMove,
onMouseLeave,
onClick,
}: CircleProps<RawDatum>) => {
return (
<animated.circle
key={node.id}
cx={style.x}
cy={style.y}
r={style.radius}
fill={style.color}
stroke={style.borderColor}
strokeWidth={style.borderWidth}
opacity={style.opacity}
onMouseEnter={event => onMouseEnter?.(node, event)}
onMouseMove={event => onMouseMove?.(node, event)}
onMouseLeave={event => onMouseLeave?.(node, event)}
onClick={event => onClick?.(node, event)}
/>
)
}