X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Futils%2FprintDiagram.js;h=00ff2c792f3329d6cd055c70acfbd18c0c503806;hb=8a44494d93d5e4b62bea6ce02931b28f7d1bf260;hp=aebdc247628e27031a8f30415f497108e99d780a;hpb=6808d7a16ec1e761c6a2dffec2281c96953e4d89;p=vchess.git diff --git a/client/src/utils/printDiagram.js b/client/src/utils/printDiagram.js index aebdc247..00ff2c79 100644 --- a/client/src/utils/printDiagram.js +++ b/client/src/utils/printDiagram.js @@ -70,6 +70,7 @@ export function getDiagram(args) { const orientation = args.orientation || "w"; const markArray = getMarkArray(args.marks); const shadowArray = getShadowArray(args.shadow); + const vr = new V(); //just for pieces images paths let boardDiv = ""; const [startX, startY, inc] = orientation == "w" ? [0, 0, 1] : [V.size.x - 1, V.size.y - 1, -1]; @@ -87,15 +88,26 @@ export function getDiagram(args) { boardDiv += ""; } if (markArray.length > 0 && markArray[i][j]) - boardDiv += ""; + boardDiv += ""; boardDiv += ""; } boardDiv += ""; } return boardDiv; } + +// Method to replace diagrams in loaded HTML +export function replaceByDiag(match, p1, p2) { + const diagParts = p2.split(" "); + return getDiagram({ + position: diagParts[0], + marks: diagParts[1], + orientation: diagParts[2], + shadow: diagParts[3] + }); +}