font text barcode not resize
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
const LayerBarcode: React.FunctionComponent = ({
uuid,
index,
layerIndex,
blockIndex,
opacity,
layers = [],d3-47b6-90a6-01740e983a9b)
...config
}) => {
const [url, setUrl] = useState()
const layerConfig = config as ILayerBarCodeConfig
const barcodeRef = useRef(null)
useEffect(() => {
if (layerConfig?.barCodeValue) {
setUrl(layerConfig?.barCodeValue?.url)
}
}, [layerConfig?.barCodeValue])
const { width, height } = layerConfig.size || {}
useEffect(() => {
if (barcodeRef.current) {
JsBarcode(barcodeRef.current, url, {
text: layerConfig?.barCodeValue?.url,
format: layerConfig?.barCodeValue?.type,
width: 30,
lineColor: '#000',
height: height * 0.8,
displayValue: true,
background: '#ffffff',
textAlign: 'center',
fontSize: width * 0.1,
font: 'monospace',
})
dispatchUpdateCurrentLayerConfig({ maxWidth: width, fontSize: '100px' })
}
}, [url, layerConfig.size.height, layerConfig?.barCodeValue, height])
return (
)
}

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the React barcode component shown in the issue and reproduce the font and barcode sizing behavior while changing the layer dimensions. Trace how the canvas style and JsBarcode options use the configured width and height. Done means the barcode text and bars resize with the layer without breaking existing rendering; no test file is named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100