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