list point signature
This commit is contained in:
parent
a6d5239855
commit
f87632dd8d
|
@ -7,12 +7,18 @@ import ParamIconSrcViewer from "../../../containers/param/disposable/ParamIconSr
|
||||||
|
|
||||||
const IconParams = ({ icon, onChange }) => {
|
const IconParams = ({ icon, onChange }) => {
|
||||||
const { enabled, src, scale } = icon;
|
const { enabled, src, scale } = icon;
|
||||||
|
const components = [];
|
||||||
|
|
||||||
if (getExactValue(enabled, 0) == 3) {
|
if (getExactValue(enabled, 0) == 3) {
|
||||||
return (
|
components.push(
|
||||||
<React.Fragment>
|
|
||||||
<FrameworkParam paramName={"图标源"}>
|
<FrameworkParam paramName={"图标源"}>
|
||||||
<ParamIconSrcViewer icon={icon} onChange={onChange}/>
|
<ParamIconSrcViewer icon={icon} onChange={onChange}/>
|
||||||
</FrameworkParam>
|
</FrameworkParam>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getExactValue(enabled, 0) != 0) {
|
||||||
|
components.push(
|
||||||
<FrameworkParam paramName={"图标缩放"}>
|
<FrameworkParam paramName={"图标缩放"}>
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
|
@ -21,10 +27,9 @@ const IconParams = ({ icon, onChange }) => {
|
||||||
onChange={(e) => onChange({...icon, scale: e.target.value})}
|
onChange={(e) => onChange({...icon, scale: e.target.value})}
|
||||||
/>
|
/>
|
||||||
</FrameworkParam>
|
</FrameworkParam>
|
||||||
</React.Fragment>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return null;
|
return components;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ParamIcon = ({icon, onChange}) => (
|
const ParamIcon = ({icon, onChange}) => (
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {ParamTypes} from "../../constant/ParamTypes";
|
||||||
import {getTypeTable, QRPointType} from "../../utils/qrcodeHandler";
|
import {getTypeTable, QRPointType} from "../../utils/qrcodeHandler";
|
||||||
import {createRenderer} from "../style/Renderer";
|
import {createRenderer} from "../style/Renderer";
|
||||||
|
|
||||||
function listPoints(qrcode, params) {
|
function listPoints({ qrcode, params, icon }) {
|
||||||
if (!qrcode) return []
|
if (!qrcode) return []
|
||||||
|
|
||||||
const nCount = qrcode.getModuleCount();
|
const nCount = qrcode.getModuleCount();
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {createRenderer, defaultDrawIcon} 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";
|
||||||
|
|
||||||
function listPoints(qrcode, params) {
|
function listPoints({ qrcode, params, icon }) {
|
||||||
if (!qrcode) return []
|
if (!qrcode) return []
|
||||||
|
|
||||||
const nCount = qrcode.getModuleCount();
|
const nCount = qrcode.getModuleCount();
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {getTypeTable, QRPointType} from "../../utils/qrcodeHandler";
|
||||||
import {createRenderer} from "../style/Renderer";
|
import {createRenderer} from "../style/Renderer";
|
||||||
import {rand} from "../../utils/util";
|
import {rand} from "../../utils/util";
|
||||||
|
|
||||||
function listPoints(qrcode, params) {
|
function listPoints({ qrcode, params, icon }) {
|
||||||
if (!qrcode) return []
|
if (!qrcode) return []
|
||||||
|
|
||||||
const nCount = qrcode.getModuleCount();
|
const nCount = qrcode.getModuleCount();
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {getTypeTable, QRPointType} from "../../utils/qrcodeHandler";
|
||||||
import {createRenderer} from "../style/Renderer";
|
import {createRenderer} from "../style/Renderer";
|
||||||
import LinkTrace from "../link/LinkTrace";
|
import LinkTrace from "../link/LinkTrace";
|
||||||
|
|
||||||
function listPoints(qrcode, params) {
|
function listPoints({ qrcode, params, icon }) {
|
||||||
if (!qrcode) return []
|
if (!qrcode) return []
|
||||||
|
|
||||||
const nCount = qrcode.getModuleCount();
|
const nCount = qrcode.getModuleCount();
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {ParamTypes} from "../../constant/ParamTypes";
|
||||||
import {getTypeTable, QRPointType} from "../../utils/qrcodeHandler";
|
import {getTypeTable, QRPointType} from "../../utils/qrcodeHandler";
|
||||||
import {createRenderer} from "../style/Renderer";
|
import {createRenderer} from "../style/Renderer";
|
||||||
|
|
||||||
function listPoints(qrcode, params) {
|
function listPoints({ qrcode, params, icon }) {
|
||||||
if (!qrcode) return []
|
if (!qrcode) return []
|
||||||
|
|
||||||
const nCount = qrcode.getModuleCount();
|
const nCount = qrcode.getModuleCount();
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {getTypeTable, QRPointType} from "../../utils/qrcodeHandler";
|
||||||
import {createRenderer} from "../style/Renderer";
|
import {createRenderer} from "../style/Renderer";
|
||||||
import {defaultImage} from "../../constant/References";
|
import {defaultImage} from "../../constant/References";
|
||||||
|
|
||||||
function listPoints(qrcode, params) {
|
function listPoints({ qrcode, params, icon }) {
|
||||||
if (!qrcode) return []
|
if (!qrcode) return []
|
||||||
|
|
||||||
const nCount = qrcode.getModuleCount();
|
const nCount = qrcode.getModuleCount();
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {getTypeTable, QRPointType} from "../../utils/qrcodeHandler";
|
||||||
import {createRenderer} from "../style/Renderer";
|
import {createRenderer} from "../style/Renderer";
|
||||||
import {rand} from "../../utils/util";
|
import {rand} from "../../utils/util";
|
||||||
|
|
||||||
function listPoints(qrcode, params) {
|
function listPoints({ qrcode, params, icon }) {
|
||||||
if (!qrcode) return []
|
if (!qrcode) return []
|
||||||
|
|
||||||
const nCount = qrcode.getModuleCount();
|
const nCount = qrcode.getModuleCount();
|
||||||
|
|
|
@ -2,7 +2,7 @@ import React from "react";
|
||||||
import {rand} from "../../utils/util";
|
import {rand} from "../../utils/util";
|
||||||
import {createRenderer} from "../style/Renderer";
|
import {createRenderer} from "../style/Renderer";
|
||||||
|
|
||||||
function listPoints(qrcode, params) {
|
function listPoints({ qrcode, params, icon }) {
|
||||||
if (!qrcode) return []
|
if (!qrcode) return []
|
||||||
|
|
||||||
const nCount = qrcode.getModuleCount();
|
const nCount = qrcode.getModuleCount();
|
||||||
|
|
|
@ -4,9 +4,9 @@ import {ParamTypes} from "../../constant/ParamTypes";
|
||||||
import {getTypeTable, QRPointType} from "../../utils/qrcodeHandler";
|
import {getTypeTable, QRPointType} from "../../utils/qrcodeHandler";
|
||||||
import {defaultResImage} from "../../constant/References";
|
import {defaultResImage} from "../../constant/References";
|
||||||
|
|
||||||
function listPoints(qrcode, params) {
|
function listPoints({ qrcode, params, icon }) {
|
||||||
if (!qrcode) return []
|
if (!qrcode) return []
|
||||||
|
console.log(icon)
|
||||||
const nCount = qrcode.getModuleCount();
|
const nCount = qrcode.getModuleCount();
|
||||||
const typeTable = getTypeTable(qrcode);
|
const typeTable = getTypeTable(qrcode);
|
||||||
const pointList = new Array(nCount);
|
const pointList = new Array(nCount);
|
||||||
|
@ -155,7 +155,7 @@ function getGrayPointList(params, size, black, white) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const RendererResImage = ({qrcode, params, setParamInfo}) => {
|
const RendererResImage = ({qrcode, params, setParamInfo, icon}) => {
|
||||||
let otherColor = params[5];
|
let otherColor = params[5];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -178,7 +178,7 @@ const RendererResImage = ({qrcode, params, setParamInfo}) => {
|
||||||
<rect id="B" width={3.08} height={3.08}/>
|
<rect id="B" width={3.08} height={3.08}/>
|
||||||
<rect id="S" width={1.02} height={1.02}/>
|
<rect id="S" width={1.02} height={1.02}/>
|
||||||
</defs>
|
</defs>
|
||||||
{gpl.concat(listPoints(qrcode, params))}
|
{gpl.concat(listPoints({ qrcode, params, icon }))}
|
||||||
</svg>
|
</svg>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ let defaultDrawIcon = function ({ qrcode, params, title, icon }) {
|
||||||
export function createRenderer(renderer) {
|
export function createRenderer(renderer) {
|
||||||
renderer = extend({
|
renderer = extend({
|
||||||
getViewBox: defaultViewBox,
|
getViewBox: defaultViewBox,
|
||||||
listPoints: (qrcode, params) => { return []; },
|
listPoints: ({ qrcode, params, icon }) => { return []; },
|
||||||
getParamInfo: () => {return []; },
|
getParamInfo: () => {return []; },
|
||||||
beginRendering: ({ qrcode, params, setParamInfo }) => {},
|
beginRendering: ({ qrcode, params, setParamInfo }) => {},
|
||||||
beforeListing: ({ qrcode, params, setParamInfo }) => {},
|
beforeListing: ({ qrcode, params, setParamInfo }) => {},
|
||||||
|
@ -60,7 +60,7 @@ export function createRenderer(renderer) {
|
||||||
<svg className="Qr-item-svg" width="100%" height="100%" viewBox={renderer.getViewBox(qrcode)} fill="white"
|
<svg className="Qr-item-svg" width="100%" height="100%" viewBox={renderer.getViewBox(qrcode)} fill="white"
|
||||||
xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">
|
xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">
|
||||||
{renderer.beforeListing({ qrcode, params, setParamInfo })}
|
{renderer.beforeListing({ qrcode, params, setParamInfo })}
|
||||||
{renderer.listPoints(qrcode, params)}
|
{renderer.listPoints({ qrcode, params, icon })}
|
||||||
{renderer.drawIcon({ qrcode, params, title, icon })}
|
{renderer.drawIcon({ qrcode, params, title, icon })}
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue