From c7264235b11f39064ac821a9e6e0e8b500f92a0f Mon Sep 17 00:00:00 2001 From: Klemek Date: Tue, 16 Jul 2019 16:45:14 +0200 Subject: [PATCH] [skip CI] WIP node sub text --- build_preview.js | 2 +- src/rendering.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build_preview.js b/build_preview.js index 9a878a4..300d003 100644 --- a/build_preview.js +++ b/build_preview.js @@ -50,7 +50,7 @@ const data = { { name: 'node1', icon: 'laptop-code', - bottom: 'my app', + bottom: 'my\napp', top:'my app', left:'my\napp' }, diff --git a/src/rendering.js b/src/rendering.js index 2217cec..2501514 100644 --- a/src/rendering.js +++ b/src/rendering.js @@ -246,11 +246,11 @@ module.exports = (options) => { if (!text.includes('\n')) return {'_text': text}; const list = []; - text.split('\n').map(t => t.trim()).forEach(line => { + text.split('\n').map(t => t.trim()).forEach((line,i) => { list.push({ '_attributes': { 'x': 0, - 'dy': `${lineHeight}em`, + 'dy': `${i*lineHeight}em`, 'text-anchor': anchor }, '_text': line @@ -320,7 +320,7 @@ module.exports = (options) => { 'font-size': fontSize, 'text-anchor': anchor, 'x': pos.x * fontSize, - 'y': (pos.y + 0.25) * fontSize - textHeight * fontSize + 'y': (pos.y + 0.25) * fontSize - textHeight * fontSize / 2 }; g['g'].push({