Commit 4eef086 1 parent 459fe6b commit 4eef086 Copy full SHA for 4eef086
File tree 3 files changed +44
-319
lines changed
3 files changed +44
-319
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ type RectsMapItemType = {
30
30
export type OptionsType = ParentOptionsType & {
31
31
fgColor : string ;
32
32
bgColor ?: string ;
33
+ width ?: number ;
34
+ height ?: number ;
33
35
} ;
34
36
35
37
const DEFAULT_OPTIONS = {
@@ -41,6 +43,8 @@ export default class QRCodeSVG extends AbstractQRCodeWithImage {
41
43
fgColor : string ;
42
44
bgColor : string ;
43
45
qrCodeSVG : string | null = null ;
46
+ height ?: number ;
47
+ width ?: number ;
44
48
qrCodeDataUrl : string | null = null ;
45
49
46
50
constructor ( value : string , options : Partial < OptionsType > = { } ) {
@@ -49,6 +53,8 @@ export default class QRCodeSVG extends AbstractQRCodeWithImage {
49
53
50
54
this . fgColor = params . fgColor ;
51
55
this . bgColor = params . bgColor ;
56
+ this . width = params . width ;
57
+ this . height = params . height ;
52
58
}
53
59
54
60
_clearCache ( ) : void {
@@ -201,7 +207,9 @@ export default class QRCodeSVG extends AbstractQRCodeWithImage {
201
207
const size = this . getDataSize ( ) ;
202
208
const tags = [
203
209
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" ' +
204
- `shape-rendering="crispEdges" viewBox="0 0 ${ size } ${ size } ">` ,
210
+ `shape-rendering="crispEdges" viewBox="0 0 ${ size } ${ size } "${
211
+ this . width ? ` width=${ this . width } ` : ''
212
+ } ${ this . height ? ` height=${ this . height } ` : '' } >`,
205
213
] ;
206
214
207
215
if ( this . bgColor ) {
You can’t perform that action at this time.
0 commit comments