Open milabi opened 3 years ago
I had this on the old code. Try removing Math.floor here: https://github.com/neocotic/qrious/blob/master/dist/qrious.js#L312
I realize this is an old thread, but wanted to add a note for anyone else who may be looking for a solution to the padding issue.
It appears to me that the getModuleSize function already accounts for the padding value. As such, there is no need to add a condition in the getOffset function to handle padding.
I made the following edit with positive results:
getOffset: function(frame) {
var qrious = this.qrious;
/* var padding = qrious.padding;
*
* if (padding != null) {
* return padding;
* }
*/
var moduleSize = this.getModuleSize(frame);
var offset = Math.floor((qrious.size - (moduleSize * frame.width)) / 2);
return Math.max(0, offset);
},
thanks! try to make a PR so maybe the author will merge it!
qr.background = '#cfcfcf'; qr.backgroundAlpha = 1.0; qr.foregroundAlpha = 1.0; qr.foreground = '#000000'; qr.level = 'L'; qr.padding = 10; qr.size = 220; qr.value = 'https://github.com/neocotic/qrious/issues/123';