When serializing the canvas data with toDataURL and then again de-serializing the same data with fromDataURL, the canvas content is not scaled correctly on device with a device pixel ratio larger than 1. The drawing is duplicated in the top left corner, scaled down:
Here is a repro sandbox: https://codesandbox.io/s/elated-cookies-50yg2?file=/src/App.js
Try it on a device with pixel ratio 1, works fine, but on a retina screen or iphone you can observe the effect above. You can even use the iPhone emulator in chrome desktop.
When serializing the canvas data with![image](https://user-images.githubusercontent.com/1181371/133975531-ad1e7d8a-1077-45ee-8f8f-36ae6bdf114a.png)
toDataURL
and then again de-serializing the same data withfromDataURL
, the canvas content is not scaled correctly on device with a device pixel ratio larger than 1. The drawing is duplicated in the top left corner, scaled down:Here is a repro sandbox: https://codesandbox.io/s/elated-cookies-50yg2?file=/src/App.js Try it on a device with pixel ratio 1, works fine, but on a retina screen or iphone you can observe the effect above. You can even use the iPhone emulator in chrome desktop.