offline-qr-code
offline-qr-code copied to clipboard
Size of QR code (and quiet zone) on Android is awkward
It works somewhat strangely:
- always "auto-scaling" enabled
- if you have it in the SVG mode: the padding (quiet zone) is nowhere shown, it is likely outside of the menu
- if in Canvas mode: although you only have a quiet zone of 1, you get a quite small QR code (at the top!)
Both looks strange…
Okay, actually the issue is a big CSS thing… so I tried around a little and there are multiple cases:
- we set
width: auto
in order to horizontally center the qr code if it is a canvas here: https://github.com/rugk/offline-qr-code/blob/57f6873e38c46bd7e7ccb2a42539efdc6f620874/src/popup/modules/UserInterface.js#L525 - also the SVG and Canvas handling is totally different. Canvas is resized manually when the popup resizes, SVG does not need this thanks to it's dynamically "resizability": https://github.com/rugk/offline-qr-code/blob/57f6873e38c46bd7e7ccb2a42539efdc6f620874/src/popup/modules/UserInterface.js#L235-L238
This results in:
- if you remove the
width: auto
and usewidth: 100%
of the qrcode-resize-area, the SVG is correctly resized and the padding is visible - manually setting the size is likely also not a good idea in the Canvas way, as this obviously also is the wrong size for the container, actually, as the padding ("quiet zone") is added to the size of the QR code itself…
Also the CSS may generally need some redoing. I maybe need to separate the SVG and Canvas handling in CSS a bit more, e.g.…