Fix Warning

This commit is contained in:
CPunisher 2021-01-15 11:53:39 +08:00
parent 8c56cb347b
commit f06f2c9b2a
10 changed files with 41 additions and 28 deletions

1
debug.log Normal file
View File

@ -0,0 +1 @@
[0113/225246.323:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)

View File

@ -1,5 +1,4 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'
import '../Qrcode.css'; import '../Qrcode.css';
const FrameworkParam = ({ paramName, children, ...other }) => ( const FrameworkParam = ({ paramName, children, ...other }) => (

View File

@ -9,7 +9,7 @@ const IconParams = ({ icon, onBlur, onKeyPress }) => {
const { enabled, src, scale } = icon; const { enabled, src, scale } = icon;
const components = []; const components = [];
if (getExactValue(enabled, 0) == 1) { if (getExactValue(enabled, 0) === 1) {
components.push( components.push(
<FrameworkParam paramName={"图标源"}> <FrameworkParam paramName={"图标源"}>
<ParamIconSrcViewer icon={icon} onChange={onBlur}/> <ParamIconSrcViewer icon={icon} onChange={onBlur}/>
@ -17,7 +17,7 @@ const IconParams = ({ icon, onBlur, onKeyPress }) => {
); );
} }
if (getExactValue(enabled, 0) != 0) { if (getExactValue(enabled, 0) !== 0) {
components.push( components.push(
<FrameworkParam paramName={"图标缩放"}> <FrameworkParam paramName={"图标缩放"}>
<input <input

View File

@ -0,0 +1,6 @@
import React from "react";
import PropTypes from 'prop-types'
const PresetModal({ visible, onClose, }) => {
}

View File

@ -34,13 +34,13 @@ function listPoints({ qrcode, params, icon }) {
if (qrcode.isDark(x, y) === false) continue; if (qrcode.isDark(x, y) === false) continue;
else if (typeTable[x][y] === QRPointType.POS_OTHER || typeTable[x][y] === QRPointType.POS_CENTER) { else if (typeTable[x][y] === QRPointType.POS_OTHER || typeTable[x][y] === QRPointType.POS_CENTER) {
pointList.push(<rect width={size2} height={size2} key={id++} fill={upColor} x={x + (1 - size2)/2} y={y + (1 - size2)/2} transform={matrixString}/>); pointList.push(<rect width={size2} height={size2} key={id++} fill={upColor} x={x + (1 - size2)/2} y={y + (1 - size2)/2} transform={matrixString}/>);
pointList.push(<rect width={height2} height={size2} key={id++} fill={leftColor} x={0} y={0} transform={matrixString+'translate('+String(x + (1 - size2)/2 + size2)+','+String(y + (1 - size2)/2)+') '+'skewY(45) '}/>); pointList.push(<rect width={height2} height={size2} key={id++} fill={leftColor} x={0} y={0} transform={`${matrixString} translate(${x + (1 - size2)/2 + size2}, ${y + (1 - size2)/2}) skewY(45)`}/>);
pointList.push(<rect width={size2} height={height2} key={id++} fill={rightColor} x={0} y={0} transform={matrixString+'translate('+String(x + (1 - size2)/2)+','+String(y + size2 + (1 - size2)/2)+') '+'skewX(45) '}/>); pointList.push(<rect width={size2} height={height2} key={id++} fill={rightColor} x={0} y={0} transform={`${matrixString} translate(${x + (1 - size2)/2}, ${y + size2 + (1 - size2)/2}) skewX(45)`}/>);
} }
else { else {
pointList.push(<rect width={size} height={size} key={id++} fill={upColor} x={x + (1 - size)/2} y={y + (1 - size)/2} transform={matrixString}/>); pointList.push(<rect width={size} height={size} key={id++} fill={upColor} x={x + (1 - size)/2} y={y + (1 - size)/2} transform={matrixString}/>);
pointList.push(<rect width={height} height={size} key={id++} fill={leftColor} x={0} y={0} transform={matrixString+'translate('+String(x + (1 - size)/2 + size)+','+String(y + (1 - size)/2)+') '+'skewY(45) '}/>); pointList.push(<rect width={height} height={size} key={id++} fill={leftColor} x={0} y={0} transform={`${matrixString} translate(${x + (1 - size)/2 + size}, ${y + (1 - size)/2}) skewY(45)`}/>);
pointList.push(<rect width={size} height={height} key={id++} fill={rightColor} x={0} y={0} transform={matrixString+'translate('+String(x + (1 - size)/2)+','+String(y + size + (1 - size)/2)+') '+'skewX(45) '}/>); pointList.push(<rect width={size} height={height} key={id++} fill={rightColor} x={0} y={0} transform={`${matrixString} translate(${x + (1 - size)/2}, ${y + size + (1 - size)/2}) skewX(45)`}/>);
} }
} }
} }
@ -100,13 +100,14 @@ let defaultDrawIcon = function ({ qrcode, params, title, icon }) {
const randomIdClips = getIdNum(); const randomIdClips = getIdNum();
pointList.push( pointList.push(
<g transform={matrixString}> <g transform={matrixString}>
<path d={sq25} stroke="#FFF" strokeWidth={100/iconSize * 1} fill="#FFF" transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} /> <path d={sq25} stroke="#FFF" strokeWidth={100/iconSize * 1} fill="#FFF" transform={`translate(${iconXY}, ${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} />
</g> </g>
); );
pointList.push( pointList.push(
<g key={id++} transform={matrixString}> <g key={id++} transform={matrixString}>
<defs> <defs>
<path id={"defs-path" + randomIdDefs} d={sq25} fill="#FFF" transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} /> </defs> <path id={"defs-path" + randomIdDefs} d={sq25} fill="#FFF" transform={`translate(${iconXY}, ${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} />
</defs>
<clipPath id={"clip-path" + randomIdClips}> <clipPath id={"clip-path" + randomIdClips}>
<use xlinkHref={"#defs-path" + randomIdDefs} overflow="visible"/> <use xlinkHref={"#defs-path" + randomIdDefs} overflow="visible"/>
</clipPath> </clipPath>
@ -184,18 +185,19 @@ let builtinDrawIcon = function ({ qrcode, params, title, icon }) {
const randomIdClips = getIdNum(); const randomIdClips = getIdNum();
pointList.push( pointList.push(
<g transform={matrixString}> <g transform={matrixString}>
<path d={sq25} stroke="#FFF" strokeWidth={100/iconSize * 1} fill="#FFF" transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} /> <path d={sq25} stroke="#FFF" strokeWidth={100/iconSize * 1} fill="#FFF" transform={`translate(${iconXY}, ${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} />
</g> </g>
); );
pointList.push( pointList.push(
<g key={id++} transform={matrixString}> <g key={id++} transform={matrixString}>
<defs> <defs>
<path id={"defs-path" + randomIdDefs} d={sq25} fill="#FFF" transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} /> </defs> <path id={"defs-path" + randomIdDefs} d={sq25} fill="#FFF" transform={`translate(${iconXY}, ${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} />
</defs>
<clipPath id={"clip-path" + randomIdClips}> <clipPath id={"clip-path" + randomIdClips}>
<use xlinkHref={"#defs-path" + randomIdDefs} overflow="visible"/> <use xlinkHref={"#defs-path" + randomIdDefs} overflow="visible"/>
</clipPath> </clipPath>
<g clipPath={"url(#clip-path" + randomIdClips + ")"}> <g clipPath={"url(#clip-path" + randomIdClips + ")"}>
<g transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} > <g transform={`translate(${iconXY}, ${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} >
{builtinIcon()} {builtinIcon()}
</g> </g>
</g> </g>

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import {ParamTypes} from "../../constant/ParamTypes"; import {ParamTypes} from "../../constant/ParamTypes";
import {getTypeTable, QRPointType} from "../../utils/qrcodeHandler"; import {getTypeTable, QRPointType} from "../../utils/qrcodeHandler";
import {createRenderer, defaultDrawIcon} from "../style/Renderer"; import {createRenderer} from "../style/Renderer";
import {getExactValue, rand} from "../../utils/util"; import {getExactValue, rand} from "../../utils/util";
import LinkTrace from "../link/LinkTrace"; import LinkTrace from "../link/LinkTrace";
@ -14,7 +14,7 @@ function listPoints({ qrcode, params, icon }) {
const {src, scale} = icon; const {src, scale} = icon;
const iconSize = Number(nCount * (scale > .33 ? .33 : scale)); const iconSize = Number(nCount * (scale > .33 ? .33 : scale));
const iconXY = (nCount - iconSize) / 2; // const iconXY = (nCount - iconSize) / 2;
function nearIcon(x, y) { function nearIcon(x, y) {
return Math.pow((nCount - 1) / 2 - x, 2) + Math.pow((nCount - 1) / 2 - y, 2) < Math.pow(iconSize / 2, 2); return Math.pow((nCount - 1) / 2 - x, 2) + Math.pow((nCount - 1) / 2 - y, 2) < Math.pow(iconSize / 2, 2);
@ -67,7 +67,7 @@ function listPoints({ qrcode, params, icon }) {
} }
} else if (posType === 3) { } else if (posType === 3) {
pointList.push(<circle key={id++} fill={posColor} cx={x + 0.5} cy={y + 0.5} r={1.5} />) pointList.push(<circle key={id++} fill={posColor} cx={x + 0.5} cy={y + 0.5} r={1.5} />)
pointList.push(<path key={id++} d={sq25} stroke={posColor} strokeWidth={100/6 * (1 - (1 - size) * 0.75)} fill="none" transform={'translate('+String(x - 2.5)+','+String(y - 2.5)+') ' + 'scale(' + String(6/100) + ',' + String(6/100) + ')'} />) pointList.push(<path key={id++} d={sq25} stroke={posColor} strokeWidth={100/6 * (1 - (1 - size) * 0.75)} fill="none" transform={`translate(${x - 2.5}, ${y - 2.5}) scale(0.06, 0.06)`} />)
} }
} }
else if (typeTable[x][y] === QRPointType.POS_OTHER) { else if (typeTable[x][y] === QRPointType.POS_OTHER) {

View File

@ -51,7 +51,7 @@ function listPoints({ qrcode, params, icon }) {
} }
} else if (posType === 3) { } else if (posType === 3) {
pointList.push(<circle key={id++} fill={posColor} cx={x + 0.5} cy={y + 0.5} r={1.5} />) pointList.push(<circle key={id++} fill={posColor} cx={x + 0.5} cy={y + 0.5} r={1.5} />)
pointList.push(<path key={id++} d={sq25} stroke={posColor} strokeWidth={100/6 * (1 - (1 - 0.8) * 0.75)} fill="none" transform={'translate('+String(x - 2.5)+','+String(y - 2.5)+') ' + 'scale(' + String(6/100) + ',' + String(6/100) + ')'} />) pointList.push(<path key={id++} d={sq25} stroke={posColor} strokeWidth={100/6 * (1 - (1 - 0.8) * 0.75)} fill="none" transform={`translate(${x - 2.5}, ${y - 2.5}) scale(0.06, 0.06)`} />)
} }
} }
else if (qrcode.isDark(x, y) && typeTable[x][y] === QRPointType.POS_OTHER) { else if (qrcode.isDark(x, y) && typeTable[x][y] === QRPointType.POS_OTHER) {
@ -76,7 +76,7 @@ function listPoints({ qrcode, params, icon }) {
if (funcType === 1) { if (funcType === 1) {
let sizeF = 0 let sizeF = 0
let colorF = otherColor let colorF = otherColor
let fillF = colorF // let fillF = colorF
let opacityF = Number(qrcode.isDark(x, y)); let opacityF = Number(qrcode.isDark(x, y));
if (dist > 5/20 && dist < 8/20) { if (dist > 5/20 && dist < 8/20) {
sizeF = 5/10 sizeF = 5/10

View File

@ -58,7 +58,7 @@ function listPoints({ qrcode, params, icon }) {
} }
} else if (posType === 3) { } else if (posType === 3) {
pointList.push(<circle key={id++} fill={posColor} cx={x + 0.5} cy={y + 0.5} r={1.5} />) pointList.push(<circle key={id++} fill={posColor} cx={x + 0.5} cy={y + 0.5} r={1.5} />)
pointList.push(<path key={id++} d={sq25} stroke={posColor} strokeWidth={100/6 * (1 - (1 - size) * 0.75)} fill="none" transform={'translate('+String(x - 2.5)+','+String(y - 2.5)+') ' + 'scale(' + String(6/100) + ',' + String(6/100) + ')'} />) pointList.push(<path key={id++} d={sq25} stroke={posColor} strokeWidth={100/6 * (1 - (1 - size) * 0.75)} fill="none" transform={`translate(${x - 2.5}, ${y - 2.5}) scale(0.06, 0.06)`}/>)
} }
} }
else if (typeTable[x][y] === QRPointType.POS_OTHER) { else if (typeTable[x][y] === QRPointType.POS_OTHER) {

View File

@ -175,11 +175,13 @@ let defaultDrawIcon = function ({ qrcode, params, title, icon }) {
if (icon && iconEnabled) { if (icon && iconEnabled) {
const randomIdDefs = getIdNum(); const randomIdDefs = getIdNum();
const randomIdClips = getIdNum(); const randomIdClips = getIdNum();
pointList.push(<path d={sq25} stroke="#FFF" strokeWidth={100/iconSize * 3} fill="#FFF" transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} />);
pointList.push(<path d={sq25} stroke="#FFF" strokeWidth={100/iconSize * 3} fill="#FFF" transform={`translate(${iconXY},${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} />);
pointList.push( pointList.push(
<g key={id++}> <g key={id++}>
<defs> <defs>
<path id={"defs-path" + randomIdDefs} d={sq25} fill="#FFF" transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} /> </defs> <path id={"defs-path" + randomIdDefs} d={sq25} fill="#FFF" transform={`translate(${iconXY},${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} />
</defs>
<clipPath id={"clip-path" + randomIdClips}> <clipPath id={"clip-path" + randomIdClips}>
<use xlinkHref={"#defs-path" + randomIdDefs} overflow="visible"/> <use xlinkHref={"#defs-path" + randomIdDefs} overflow="visible"/>
</clipPath> </clipPath>
@ -255,16 +257,16 @@ let builtinDrawIcon = function ({ qrcode, params, title, icon }) {
if (icon && iconMode) { if (icon && iconMode) {
const randomIdDefs = getIdNum(); const randomIdDefs = getIdNum();
const randomIdClips = getIdNum(); const randomIdClips = getIdNum();
pointList.push(<path d={sq25} stroke="#FFF" strokeWidth={100/iconSize * 3} fill="#FFF" transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} />); pointList.push(<path d={sq25} stroke="#FFF" strokeWidth={100/iconSize * 3} fill="#FFF" transform={`translate(${iconXY}, ${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} />);
pointList.push( pointList.push(
<g key={id++}> <g key={id++}>
<defs> <defs>
<path id={"defs-path" + randomIdDefs} d={sq25} fill="#FFF" transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} /> </defs> <path id={"defs-path" + randomIdDefs} d={sq25} fill="#FFF" transform={`translate(${iconXY},${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} /></defs>
<clipPath id={"clip-path" + randomIdClips}> <clipPath id={"clip-path" + randomIdClips}>
<use xlinkHref={"#defs-path" + randomIdDefs} overflow="visible"/> <use xlinkHref={"#defs-path" + randomIdDefs} overflow="visible"/>
</clipPath> </clipPath>
<g clipPath={"url(#clip-path" + randomIdClips + ")"}> <g clipPath={"url(#clip-path" + randomIdClips + ")"}>
<g transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} > <g transform={`translate(${iconXY},${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} >
{builtinIcon()} {builtinIcon()}
</g> </g>
</g> </g>

View File

@ -35,11 +35,13 @@ let defaultDrawIcon = function ({ qrcode, params, title, icon }) {
if (icon && iconEnabled) { if (icon && iconEnabled) {
const randomIdDefs = getIdNum(); const randomIdDefs = getIdNum();
const randomIdClips = getIdNum(); const randomIdClips = getIdNum();
pointList.push(<path d={sq25} stroke="#FFF" strokeWidth={100/iconSize * 1} fill="#FFF" transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} />);
pointList.push(<path d={sq25} stroke="#FFF" strokeWidth={100/iconSize * 1} fill="#FFF" transform={`translate(${iconXY}, ${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} />);
pointList.push( pointList.push(
<g key={id++}> <g key={id++}>
<defs> <defs>
<path id={"defs-path" + randomIdDefs} d={sq25} fill="#FFF" transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} /> </defs> <path id={"defs-path" + randomIdDefs} d={sq25} fill="#FFF" transform={`translate(${iconXY}, ${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} />
</defs>
<clipPath id={"clip-path" + randomIdClips}> <clipPath id={"clip-path" + randomIdClips}>
<use xlinkHref={"#defs-path" + randomIdDefs} overflow="visible"/> <use xlinkHref={"#defs-path" + randomIdDefs} overflow="visible"/>
</clipPath> </clipPath>
@ -115,16 +117,17 @@ let builtinDrawIcon = function ({ qrcode, params, title, icon }) {
if (icon && iconMode) { if (icon && iconMode) {
const randomIdDefs = getIdNum(); const randomIdDefs = getIdNum();
const randomIdClips = getIdNum(); const randomIdClips = getIdNum();
pointList.push(<path d={sq25} stroke="#FFF" strokeWidth={100/iconSize * 1} fill="#FFF" transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} />); pointList.push(<path d={sq25} stroke="#FFF" strokeWidth={100/iconSize * 1} fill="#FFF" transform={`translate(${iconXY}, ${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} />);
pointList.push( pointList.push(
<g key={id++}> <g key={id++}>
<defs> <defs>
<path id={"defs-path" + randomIdDefs} d={sq25} fill="#FFF" transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} /> </defs> <path id={"defs-path" + randomIdDefs} d={sq25} fill="#FFF" transform={`translate(${iconXY}, ${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} />
</defs>
<clipPath id={"clip-path" + randomIdClips}> <clipPath id={"clip-path" + randomIdClips}>
<use xlinkHref={"#defs-path" + randomIdDefs} overflow="visible"/> <use xlinkHref={"#defs-path" + randomIdDefs} overflow="visible"/>
</clipPath> </clipPath>
<g clipPath={"url(#clip-path" + randomIdClips + ")"}> <g clipPath={"url(#clip-path" + randomIdClips + ")"}>
<g transform={'translate('+String(iconXY)+','+String(iconXY)+') ' + 'scale(' + String(iconSize/100) + ',' + String(iconSize/100) + ')'} > <g transform={`translate(${iconXY}, ${iconXY}) scale(${iconSize / 100}, ${iconSize / 100})`} >
{builtinIcon()} {builtinIcon()}
</g> </g>
</g> </g>