[skip CI] WIP node sub text

This commit is contained in:
Klemek
2019-07-16 16:45:14 +02:00
parent dabb4e25cc
commit c7264235b1
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ const data = {
{ {
name: 'node1', name: 'node1',
icon: 'laptop-code', icon: 'laptop-code',
bottom: 'my app', bottom: 'my\napp',
top:'my app', top:'my app',
left:'my\napp' left:'my\napp'
}, },
+3 -3
View File
@@ -246,11 +246,11 @@ module.exports = (options) => {
if (!text.includes('\n')) if (!text.includes('\n'))
return {'_text': text}; return {'_text': text};
const list = []; const list = [];
text.split('\n').map(t => t.trim()).forEach(line => { text.split('\n').map(t => t.trim()).forEach((line,i) => {
list.push({ list.push({
'_attributes': { '_attributes': {
'x': 0, 'x': 0,
'dy': `${lineHeight}em`, 'dy': `${i*lineHeight}em`,
'text-anchor': anchor 'text-anchor': anchor
}, },
'_text': line '_text': line
@@ -320,7 +320,7 @@ module.exports = (options) => {
'font-size': fontSize, 'font-size': fontSize,
'text-anchor': anchor, 'text-anchor': anchor,
'x': pos.x * fontSize, 'x': pos.x * fontSize,
'y': (pos.y + 0.25) * fontSize - textHeight * fontSize 'y': (pos.y + 0.25) * fontSize - textHeight * fontSize / 2
}; };
g['g'].push({ g['g'].push({