diff --git a/src/components/param/disposable/ParamIcon.js b/src/components/param/disposable/ParamIcon.js index 8a714b8..648a1bc 100644 --- a/src/components/param/disposable/ParamIcon.js +++ b/src/components/param/disposable/ParamIcon.js @@ -7,24 +7,29 @@ import ParamIconSrcViewer from "../../../containers/param/disposable/ParamIconSr const IconParams = ({ icon, onChange }) => { const { enabled, src, scale } = icon; + const components = []; + if (getExactValue(enabled, 0) == 3) { - return ( - - - - - - onChange({...icon, scale: e.target.value})} - /> - - + components.push( + + + + ); + } + + if (getExactValue(enabled, 0) != 0) { + components.push( + + onChange({...icon, scale: e.target.value})} + /> + ) } - return null; + return components; } const ParamIcon = ({icon, onChange}) => ( diff --git a/src/components/renderer/Renderer25D.js b/src/components/renderer/Renderer25D.js index 4aebef5..9d0e206 100644 --- a/src/components/renderer/Renderer25D.js +++ b/src/components/renderer/Renderer25D.js @@ -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(); diff --git a/src/components/renderer/RendererBase.js b/src/components/renderer/RendererBase.js index 4bf9425..bebf89c 100644 --- a/src/components/renderer/RendererBase.js +++ b/src/components/renderer/RendererBase.js @@ -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(); diff --git a/src/components/renderer/RendererCircle.js b/src/components/renderer/RendererCircle.js index d5e6788..b0a9329 100644 --- a/src/components/renderer/RendererCircle.js +++ b/src/components/renderer/RendererCircle.js @@ -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(); diff --git a/src/components/renderer/RendererDSJ.js b/src/components/renderer/RendererDSJ.js index bde7224..31ee9a5 100644 --- a/src/components/renderer/RendererDSJ.js +++ b/src/components/renderer/RendererDSJ.js @@ -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(); diff --git a/src/components/renderer/RendererFunc.js b/src/components/renderer/RendererFunc.js index 7bd2b46..52753b5 100644 --- a/src/components/renderer/RendererFunc.js +++ b/src/components/renderer/RendererFunc.js @@ -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(); diff --git a/src/components/renderer/RendererImage.js b/src/components/renderer/RendererImage.js index 5f9f7fe..e3f2cda 100644 --- a/src/components/renderer/RendererImage.js +++ b/src/components/renderer/RendererImage.js @@ -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(); diff --git a/src/components/renderer/RendererLine.js b/src/components/renderer/RendererLine.js index 72a1420..e81686f 100644 --- a/src/components/renderer/RendererLine.js +++ b/src/components/renderer/RendererLine.js @@ -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(); diff --git a/src/components/renderer/RendererRandRect.js b/src/components/renderer/RendererRandRect.js index 78571f6..7fbaf86 100644 --- a/src/components/renderer/RendererRandRect.js +++ b/src/components/renderer/RendererRandRect.js @@ -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(); diff --git a/src/components/renderer/RendererResImage.js b/src/components/renderer/RendererResImage.js index 02d6264..de74eb8 100644 --- a/src/components/renderer/RendererResImage.js +++ b/src/components/renderer/RendererResImage.js @@ -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}) => { - {gpl.concat(listPoints(qrcode, params))} + {gpl.concat(listPoints({ qrcode, params, icon }))} ) } diff --git a/src/components/style/Renderer.js b/src/components/style/Renderer.js index c5d1898..92e55a9 100644 --- a/src/components/style/Renderer.js +++ b/src/components/style/Renderer.js @@ -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) { {renderer.beforeListing({ qrcode, params, setParamInfo })} - {renderer.listPoints(qrcode, params)} + {renderer.listPoints({ qrcode, params, icon })} {renderer.drawIcon({ qrcode, params, title, icon })} );