UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

1 lines • 914 B
{"version":3,"file":"qrPath.mjs","names":[],"sources":["../../../src/base-ui/QRCode/qrPath.ts"],"sourcesContent":["export const buildQrPath = (matrix: boolean[][], hole: number): string => {\n const count = matrix.length;\n const from = Math.floor((count - hole) / 2);\n const to = from + hole;\n let path = '';\n for (let y = 0; y < count; y++) {\n for (let x = 0; x < count; x++) {\n if (hole > 0 && x >= from && x < to && y >= from && y < to) continue;\n if (matrix[y][x]) path += `M${x} ${y}h1v1h-1z`;\n }\n }\n return path;\n};\n"],"mappings":";AAAA,MAAa,eAAe,QAAqB,SAAyB;CACxE,MAAM,QAAQ,OAAO;CACrB,MAAM,OAAO,KAAK,OAAO,QAAQ,QAAQ,CAAC;CAC1C,MAAM,KAAK,OAAO;CAClB,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KACzB,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KAAK;EAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,KAAK,QAAQ,IAAI,IAAI;EAC5D,IAAI,OAAO,EAAE,CAAC,IAAI,QAAQ,IAAI,EAAE,GAAG,EAAE;CACvC;CAEF,OAAO;AACT"}