Fill properly tiles on export
This commit is contained in:
parent
26dceaba06
commit
17a2cd156d
8
geneit_app/src/utils/string_utils.ts
Normal file
8
geneit_app/src/utils/string_utils.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export function getAllIndexes(s: string, val: string) {
|
||||
var indexes = [],
|
||||
i = -1;
|
||||
while ((i = s.indexOf(val, i + 1)) !== -1) {
|
||||
indexes.push(i);
|
||||
}
|
||||
return indexes;
|
||||
}
|
@ -9,6 +9,7 @@ import { IconButton } from "@mui/material";
|
||||
import PictureAsPdfIcon from "@mui/icons-material/PictureAsPdf";
|
||||
import { jsPDF } from "jspdf";
|
||||
import "svg2pdf.js";
|
||||
import { getAllIndexes } from "../../utils/string_utils";
|
||||
|
||||
export function ComplexFamilyTree(p: {
|
||||
tree: FamilyTreeNode;
|
||||
@ -112,6 +113,21 @@ export function ComplexFamilyTree(p: {
|
||||
|
||||
dstSVG = dstSVG.replaceAll(`>UNKNOWN<`, `fill="#000">INCONNU<`);
|
||||
|
||||
let womanTiles = getAllIndexes(dstSVG, "card-female");
|
||||
for (const i of womanTiles) {
|
||||
dstSVG =
|
||||
dstSVG.substring(0, i) +
|
||||
dstSVG.substring(i + 1).replace(`fill="white"`, `fill="#ffb6c1"`);
|
||||
}
|
||||
|
||||
let manTiles = getAllIndexes(dstSVG, "card-male");
|
||||
for (const i of manTiles) {
|
||||
dstSVG =
|
||||
dstSVG.substring(0, i) +
|
||||
dstSVG.substring(i + 1).replace(`fill="white"`, `fill="#add8e6"`);
|
||||
}
|
||||
|
||||
//navigator.clipboard.writeText(dstSVG);
|
||||
target.innerHTML = dstSVG;
|
||||
|
||||
await doc.svg(target, {
|
||||
|
Loading…
Reference in New Issue
Block a user