
This PR cleans up exports from TldrawUi, unifying types under `TLUi` and removing many items from exports / marking others as internal. ### Change Type - [x] `major` — Breaking Change ### Release Notes - [editor] clean up / unify types
14 lines
397 B
TypeScript
14 lines
397 B
TypeScript
import { useLayoutEffect } from 'react'
|
|
|
|
/** @internal */
|
|
export function useHighDpiCanvas(ref: React.RefObject<HTMLCanvasElement>, dpr: number) {
|
|
// Match the resolution of the client
|
|
useLayoutEffect(() => {
|
|
const canvas = ref.current
|
|
if (!canvas) return
|
|
|
|
const rect = canvas.getBoundingClientRect()
|
|
canvas.width = rect.width * dpr
|
|
canvas.height = rect.height * dpr
|
|
}, [ref, dpr])
|
|
}
|