Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toDataURL / fromDataURL scaling with device pixel ratios > 1 #63

Closed
buesing opened this issue Sep 20, 2021 · 2 comments
Closed

toDataURL / fromDataURL scaling with device pixel ratios > 1 #63

buesing opened this issue Sep 20, 2021 · 2 comments
Labels
kind: support Asking for support with something or a specific use case scope: upstream Issue in upstream dependency solution: already possible This is already possible / this feature already exists solution: duplicate solution: intended behavior This is not a bug and is expected behavior

Comments

@buesing
Copy link

buesing commented Sep 20, 2021

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:
image

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.

@buesing
Copy link
Author

buesing commented Sep 30, 2021

My bad, the solution is described here https://github.com/szimek/signature_pad#handling-high-dpi-screens

@buesing buesing closed this as completed Sep 30, 2021
@agilgur5 agilgur5 changed the title Bug with toDataURL and device pixel ratios > 1 toDataURL / fromDataURL and device pixel ratios > 1 Feb 3, 2022
@agilgur5 agilgur5 added scope: upstream Issue in upstream dependency kind: support Asking for support with something or a specific use case solution: already possible This is already possible / this feature already exists solution: intended behavior This is not a bug and is expected behavior labels Feb 3, 2022
@agilgur5 agilgur5 changed the title toDataURL / fromDataURL and device pixel ratios > 1 toDataURL / fromDataURL scaling with device pixel ratios > 1 Feb 5, 2022
@agilgur5
Copy link
Owner

agilgur5 commented Feb 5, 2022

Yup, those are the relevant docs for DPR scaling 👍 . This also duplicates #6

Repository owner locked as resolved and limited conversation to collaborators Feb 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: support Asking for support with something or a specific use case scope: upstream Issue in upstream dependency solution: already possible This is already possible / this feature already exists solution: duplicate solution: intended behavior This is not a bug and is expected behavior
Projects
None yet
Development

No branches or pull requests

2 participants