Skip to content

Commit

Permalink
feat(circle-packing): restore pixelRatio property for canvas implemen…
Browse files Browse the repository at this point in the history
…tation
  • Loading branch information
plouc authored and wyze committed Apr 26, 2021
1 parent 1091468 commit 5649103
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions packages/circle-packing/src/CirclePackingCanvas.tsx
Expand Up @@ -45,6 +45,7 @@ const InnerCirclePackingCanvas = <RawDatum,>({
tooltip = defaultProps.tooltip,
zoomedId,
role = defaultProps.role,
pixelRatio = defaultProps.pixelRatio,
}: InnerCirclePackingCanvasProps<RawDatum>) => {
const canvasEl = useRef<HTMLCanvasElement | null>(null)
const theme = useTheme()
Expand Down Expand Up @@ -79,8 +80,6 @@ const InnerCirclePackingCanvas = <RawDatum,>({
textColor: labelTextColor,
})

const pixelRatio = 2

useEffect(() => {
if (!canvasEl.current) return

Expand Down
1 change: 1 addition & 0 deletions packages/circle-packing/src/props.ts
Expand Up @@ -26,4 +26,5 @@ export const defaultProps = {
animate: true,
motionConfig: 'gentle',
role: 'img',
pixelRatio: typeof window !== 'undefined' ? window.devicePixelRatio ?? 1 : 1,
}
4 changes: 3 additions & 1 deletion packages/circle-packing/src/types.ts
Expand Up @@ -90,7 +90,9 @@ export type CirclePackingHtmlProps<RawDatum> = CirclePackingCommonProps<RawDatum
MouseHandlers<RawDatum>

export type CirclePackingCanvasProps<RawDatum> = CirclePackingCommonProps<RawDatum> &
Pick<MouseHandlers<RawDatum>, 'onMouseMove' | 'onClick'>
Pick<MouseHandlers<RawDatum>, 'onMouseMove' | 'onClick'> & {
pixelRatio: number
}

export type CircleProps<RawDatum> = {
node: ComputedDatum<RawDatum>
Expand Down

0 comments on commit 5649103

Please sign in to comment.