Skip to content

Commit

Permalink
fix(sunburst): fix logic with radius and centerX/Y
Browse files Browse the repository at this point in the history
  • Loading branch information
wyze authored and plouc committed Dec 2, 2020
1 parent 9b4630a commit ee59382
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/sunburst/src/Sunburst.tsx
Expand Up @@ -46,13 +46,13 @@ const InnerSunburst = <RawDatum,>(props: SvgProps<RawDatum>) => {
onMouseLeave,
} = { ...defaultProps, ...props }

const { margin } = useDimensions(width, height, partialMargin)
const { innerWidth, innerHeight, margin } = useDimensions(width, height, partialMargin)

const { centerX, centerY, radius } = useMemo(() => {
const radius = Math.min(width, height) / 2
const radius = Math.min(innerWidth, innerHeight) / 2

return { radius, centerX: width / 2, centerY: height / 2 }
}, [height, width])
return { radius, centerX: innerWidth / 2, centerY: innerHeight / 2 }
}, [innerHeight, innerWidth])

const { arcGenerator, nodes } = useSunburst({
childColor,
Expand Down

0 comments on commit ee59382

Please sign in to comment.