#1295 Adding support for multiline descriptions for states

This commit is contained in:
Knut Sveidqvist
2020-04-25 17:01:20 +02:00
parent e52d4ce033
commit 0aede618ec
5 changed files with 97 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
const createLabel = (vertexText, style) => {
const createLabel = (vertexText, style, isTitle) => {
const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
svgLabel.setAttribute('style', style.replace('color:', 'fill:'));
let rows = [];
@@ -11,6 +11,11 @@ const createLabel = (vertexText, style) => {
tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
tspan.setAttribute('dy', '1em');
tspan.setAttribute('x', '0');
if (isTitle) {
tspan.setAttribute('class', 'title-row');
} else {
tspan.setAttribute('class', 'row');
}
tspan.textContent = rows[j].trim();
svgLabel.appendChild(tspan);
}