tldraw/components/canvas/bounds/rotate-handle.tsx

39 lines
735 B
TypeScript
Raw Normal View History

import useHandleEvents from 'hooks/useBoundsEvents'
2021-06-03 21:17:10 +00:00
import styled from 'styles'
import { Bounds } from 'types'
export default function Rotate({
bounds,
size,
}: {
bounds: Bounds
size: number
2021-06-21 21:35:28 +00:00
}): JSX.Element {
2021-06-03 21:17:10 +00:00
const events = useHandleEvents('rotate')
return (
2021-06-03 21:17:10 +00:00
<g cursor="grab" {...events}>
<circle
cx={bounds.width / 2}
cy={size * -2}
r={size * 2}
fill="transparent"
stroke="none"
/>
<StyledRotateHandle
cx={bounds.width / 2}
cy={size * -2}
r={size / 2}
pointerEvents="none"
/>
</g>
)
}
2021-06-03 21:17:10 +00:00
const StyledRotateHandle = styled('circle', {
stroke: '$bounds',
2021-07-10 21:56:49 +00:00
fill: '$canvas',
zStrokeWidth: 1.5,
2021-06-03 21:17:10 +00:00
cursor: 'grab',
})