Skip to content

Commit

Permalink
Merge pull request #584 from correctexam/563-migrate-to-the-last-angu…
Browse files Browse the repository at this point in the history
…lar-182-to-support-isolated-module

fix #583
  • Loading branch information
barais authored Jan 14, 2025
2 parents b3ea43d + 0a1d531 commit b0ad0c6
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions src/main/webapp/app/scanexam/svg.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,28 @@ export const svgadapter = (node: any) => {
// node.attr("font-size",node.attr("font-size")/this.scale)
const text = node.node;
if (text.childNodes.length > 0) {
const content = text.childNodes[0].textContent;
let x = text.children[0].getAttribute('x');
let y = text.children[0].getAttribute('y');
if (x === null) {
x = '0';
}
if (y === null) {
y = '0';
}
text.childNodes.forEach(e1 => {
if (e1.nodeName === 'tspan') {
const tspan = e1 as Element;
const x = tspan.getAttribute('x');
const y = tspan.getAttribute('y');
/* if (x !== null && y !== null) {
(node.parent() as G).translate(+x, +y);
}*/
const t1 = text.cloneNode(false) as any;
const content = tspan.textContent;

(node.parent() as G).translate(+x, +y);
text.removeChild(text.childNodes[0]);
if (content) {
text.innerHTML = content; // text.childNodes[0].textContent
} else {
text.innerHTML = 'Text';
}
if (content) {
t1.innerHTML = content;
} else {
t1.innerHTML = 'Text';
}
t1.setAttribute('x', x);
t1.setAttribute('y', y);
(node.parent() as G).add(t1);
}
});
text.remove();
}
}
};

0 comments on commit b0ad0c6

Please sign in to comment.