File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -31,18 +31,20 @@ class QRCodeComponent extends CustomElement {
3131
3232 render ( ) {
3333 const nCount = this . #qr_code. getModuleCount ( ) ;
34+ const quietZone = 4 ;
35+ const totalCount = nCount + 2 * quietZone ;
3436 const rects = [ ] ;
3537
3638 for ( let row = 0 ; row < nCount ; row ++ ) {
3739 for ( let col = 0 ; col < nCount ; col ++ ) {
3840 if ( this . #qr_code. isDark ( row , col ) ) {
39- rects . push ( svg `<use x="${ row } " y="${ col } " href="#template"></use>` ) ;
41+ rects . push ( svg `<use x="${ row + quietZone } " y="${ col + quietZone } " href="#template"></use>` ) ;
4042 }
4143 }
4244 }
4345
4446 return svg `
45- <svg viewBox="0 0 ${ nCount } ${ nCount } " width="${ this . width } " height="${ this . height } " fill="${ this . colorLight } ">
47+ <svg viewBox="0 0 ${ totalCount } ${ totalCount } " width="${ this . width } " height="${ this . height } " fill="${ this . colorLight } ">
4648 <rect fill="${ this . colorLight } " width="100%" height="100%"></rect>
4749 <rect fill="${ this . colorDark } " width="1" height="1" id="template"></rect>
4850 ${ rects }
You can’t perform that action at this time.
0 commit comments