Total Complexity | 9 |
Complexity/F | 4.5 |
Lines of Code | 24 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | export {getEncodingHeight, getBarcodePadding}; |
||
2 | |||
3 | function getEncodingHeight(encoding, options){ |
||
4 | return options.height + |
||
5 | ((options.displayValue && encoding.text.length > 0) ? options.fontSize : 0) + |
||
6 | options.textMargin + |
||
7 | options.marginTop + |
||
8 | options.marginBottom; |
||
9 | } |
||
10 | |||
11 | function getBarcodePadding(textWidth, barcodeWidth, options){ |
||
12 | if(options.displayValue && barcodeWidth < textWidth){ |
||
13 | if(options.textAlign == "center"){ |
||
14 | return Math.floor((textWidth - barcodeWidth) / 2); |
||
15 | } |
||
16 | else if(options.textAlign == "left"){ |
||
17 | return 0; |
||
18 | } |
||
19 | else if(options.textAlign == "right"){ |
||
20 | return Math.floor(textWidth - barcodeWidth); |
||
21 | } |
||
22 | } |
||
23 | return 0; |
||
24 | } |
||
25 |