|
@@ -5,12 +5,9 @@ import CodeText from './CodeText'
|
5
|
5
|
import { code128 } from './drawCode'
|
6
|
6
|
import './style.less'
|
7
|
7
|
|
8
|
|
-const widthRatio = 0.7;
|
9
|
|
-const barHeight = 80;
|
10
|
|
-
|
11
|
8
|
export default (props) => {
|
12
|
9
|
|
13
|
|
- const { code } = props
|
|
10
|
+ const { code, ratio, height } = props
|
14
|
11
|
|
15
|
12
|
const canvasRef = useRef()
|
16
|
13
|
const ctxRef = useRef()
|
|
@@ -24,7 +21,7 @@ export default (props) => {
|
24
|
21
|
dpr: pixelRatio,
|
25
|
22
|
}
|
26
|
23
|
}, [])
|
27
|
|
- const size = useMemo(() => ({ width: sysInfo.width * sysInfo.dpr * widthRatio, height: barHeight * sysInfo.dpr }), [sysInfo])
|
|
24
|
+ const size = useMemo(() => ({ width: sysInfo.width * sysInfo.dpr * ratio, height: height * sysInfo.dpr }), [sysInfo])
|
28
|
25
|
|
29
|
26
|
const style = useMemo(() => ({ width: `${size.width}rpx`, height: `${size.height}rpx` }), [size])
|
30
|
27
|
|