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

QRCodeCanvas isn't re-rendered when zooming web page manually in a browser #372

Open
SerVB opened this issue Sep 16, 2024 · 1 comment
Open
Labels
canvas Issues with the Canvas component enhancement

Comments

@SerVB
Copy link

SerVB commented Sep 16, 2024

Hi,
I see the QRCodeCanvas is blurry when I zoom the page in via the browser. If I re-render this QRCodeCanvas manually (e.g. by changing the QR) then, it becomes sharp again because internally it's density-aware.

So I've decided to create this feature request of the QRCodeCanvas to automatically detect density change and re-render itself to be always sharp.

@zpao
Copy link
Owner

zpao commented Sep 17, 2024

Ah, I hadn't really thought about this. Honestly, my first recommendation would be to just use SVG instead of Canvas.

But practically, it may be possible to listen for resize events (which I think trigger on zoom). We'd make devicePixelRatio part of the state so we could set it and make it part of the useEffect dependencies. Should be relatively straightforward, even if extraneous for most people.

We'd want to see how pinch to zoom behaves and what that triggers / what even needs to happen.

@zpao zpao added enhancement canvas Issues with the Canvas component labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
canvas Issues with the Canvas component enhancement
Projects
None yet
Development

No branches or pull requests

2 participants