joshjg / react-canvas-knob

Flexible knob/dial input component
MIT License
44 stars 28 forks source link

Support HiDPI screens #18

Closed simonbw closed 7 years ago

simonbw commented 7 years ago

Currently if you look at this on a screen where the window.devicePixelRatio > 1 (e.g. a MacBook Pro or an iPhone) the arc drawn on the canvas is blurry.

I believe the fix is to scale the canvas by the devicePixelRatio then set it back to regular size with css. See https://www.html5rocks.com/en/tutorials/canvas/hidpi/ for more details.