Fix param setting bugs
This commit is contained in:
parent
d80dceb0c9
commit
4d1d8a1789
|
@ -7,16 +7,20 @@ function listPoint(props) {
|
|||
const qrcode = props.qrcode;
|
||||
const nCount = qrcode.getModuleCount();
|
||||
const pointList = new Array(nCount);
|
||||
const params = props.params;
|
||||
|
||||
let type = props.params[1];
|
||||
let size = props.params[0];
|
||||
let id = 0;
|
||||
|
||||
if (size <= 0) size = 1.0
|
||||
|
||||
for (let row = 0; row < nCount; row++) {
|
||||
for (let col = 0; col < nCount; col++) {
|
||||
if (qrcode.isDark(row, col)) {
|
||||
if (params[1] == 0)
|
||||
pointList.push(<rect width={params[0]} height={params[0]} key={id++} fill="black" x={row} y={col}/>)
|
||||
else if (params[1] == 1)
|
||||
pointList.push(<circle r={params[0]} key={id++} fill="black" cx={row} cy={col}/>)
|
||||
if (type == 0)
|
||||
pointList.push(<rect width={size} height={size} key={id++} fill="black" x={row} y={col}/>)
|
||||
else if (type == 1)
|
||||
pointList.push(<circle r={size} key={id++} fill="black" cx={row} cy={col}/>)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,8 +143,9 @@ class Qrcode extends React.Component {
|
|||
type="number"
|
||||
className="Qr-input small-input"
|
||||
placeholder="10"
|
||||
value={this.state.paramValue[this.state.selectedIndex][index]}
|
||||
onChange={(e) => this.setParamValue(index, e.target.value)}/>
|
||||
defaultValue={this.state.paramValue[this.state.selectedIndex][index]}
|
||||
onBlur={(e) => this.setParamValue(index, e.target.value)}
|
||||
onKeyPress={(e) => {if(e.key === 'Enter') {this.setParamValue(index, e.target.value); e.target.blur()}}}/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +165,6 @@ class Qrcode extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
console.log(1)
|
||||
return (
|
||||
<div>
|
||||
<div className="Qr-Centered">
|
||||
|
|
Loading…
Reference in New Issue