offline-qr-code icon indicating copy to clipboard operation
offline-qr-code copied to clipboard

Size of QR code (and quiet zone) on Android is awkward

Open rugk opened this issue 6 years ago • 1 comments

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…

rugk avatar Nov 28 '18 12:11 rugk

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 use width: 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.…

rugk avatar Nov 29 '18 09:11 rugk