Comments (5)
Hi,
Even thought this issue is closed, it's still happens with the latest version and its not a nice UI experience.
As wanted to use the library, I have made a tweak to improve this just one line change if you want to include into the official version.
just replace line 404 in qrious.js
from:
var offset = this.getOffset(frame);
to:
var offset=parseInt((this.element.width-(frame.width*moduleSize))/2);
tested across a variety of sizes and content
from qrious.
I confirm: This work fine exept outer line!
There is a need to draw a white border, with same size than minimal block.
Workaround consist of having image or canvas in html element white padded (even using CSS).
Border effect is that resulting image have to be resized before printing or working on.
from qrious.
There is some correction I made, margin seem fine, pixel size too, but unfortunely I don't understand why I have to run two pass... There is a working try: http://fhauri.cartou.ch/qr
--- - 2014-01-31 13:02:44.796061685 +0100
+++ qr.js 2014-01-31 12:57:51.641130369 +0100
@@ -1019,12 +1019,19 @@
// Module size of the generated QR code (i.e. 1-10).
var size = data.size >= 1 && data.size <= 10 ? data.size : 4;
// Actual size of the QR code symbol and is scaled to 25 pixels (e.g. 1 = 25px, 3 = 75px).
- size *= 25;
+// size *= 25;
+ size *= (2+width);
// `<canvas>` element used to render the QR code.
var cvs = data.canvas || createCanvas();
// Retreive the 2D context of the canvas.
var c2d = cvs.getContext('2d');
+
+ // Determine the *pixel* size.
+ var px = size;
+ px /= (2+width);
+ px = Math.round(px - 0.5);
+
// Ensure the canvas has the correct dimensions.
c2d.canvas.width = size;
c2d.canvas.height = size;
@@ -1040,11 +1047,6 @@
c2d.lineWidth = 1;
- // Determine the *pixel* size.
- var px = size;
- px /= width;
- px = Math.round(px - 0.5);
-
// Draw the QR code.
c2d.clearRect(0, 0, size, size);
c2d.fillStyle = data.background || '#fff';
@@ -1056,7 +1058,7 @@
for (i = 0; i < width; i++) {
for (j = 0; j < width; j++) {
if (frame[j * width + i]) {
- c2d.fillRect(px * i, px * j, px, px);
+ c2d.fillRect(px * (1+i), px * (1+j), px, px);
}
}
}
from qrious.
Looks like this is still an issue in the latest version: 4.0.2
My options:
var qr = new QRious({
element: canvasElement,
level: "L",
padding: 0,
size: 100,
value: "meow"
});
from qrious.
I guess it maybe because the QR code's minimal unit's size could not be bigger, otherwise, the total size would be larger than the expected size. Using the scale method may force the size to cover.
By the way, set a higher level would make it better, but also more complex.
Maybe the document should note the padding issue.
from qrious.
Related Issues (20)
- SVG generation HOT 4
- 生成二维码的字符串很长 HOT 2
- Demo broken HOT 4
- Unicode characters not working HOT 3
- 二维码能展示,但是用微信等扫描图片就扫描不出来 HOT 1
- Custom pattern QR Generator scanner and reader like facebook messenger?
- Qrious do not work when canvas read is disabled for privacy reasons HOT 2
- Is this project dead? HOT 1
- password protected qr code HOT 4
- padding not null toDataUrl Picture not centered HOT 3
- Get access to underlying modules? HOT 2
- How can I append QR code to already existing canvas element?
- Question about the LEVEL value HOT 2
- TypeError: Cannot set property 'QRious' of undefined HOT 3
- QR Code Structure HOT 1
- QRious not found since upgrade Chrome to latest version HOT 4
- The QR Generation is not working I dont know why. Heres the error Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'returnValues') at addproduct.php:152:124 at async addproduct.php:150:25
- compatibility with C sharp in VB 6
- License confusion
- What QR code format is used in the library?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qrious.