This is an automated email from the ASF dual-hosted git repository. heneveld pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git
commit fdc24e503da10ea2f65ce4f06e3bda7e26dfe6cb Author: Mykola Mandra <[email protected]> AuthorDate: Wed Jun 23 12:01:13 2021 +0100 Add path text to relationships with label data only Signed-off-by: Mykola Mandra <[email protected]> --- ui-modules/blueprint-composer/app/components/util/d3-blueprint.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui-modules/blueprint-composer/app/components/util/d3-blueprint.js b/ui-modules/blueprint-composer/app/components/util/d3-blueprint.js index b2fcc26..9728628 100755 --- a/ui-modules/blueprint-composer/app/components/util/d3-blueprint.js +++ b/ui-modules/blueprint-composer/app/components/util/d3-blueprint.js @@ -786,9 +786,11 @@ export function D3Blueprint(container, options) { .attr('from', (d)=>(d.source._id)) .attr('to', (d)=>(d.target._id)); + // Draw the relationship label that follows the path, somewhere in the middle. // NOTE `textPath` DECREASES THE UI PERFORMANCE, USE LABELS WITH CAUTION. - relationDataEntered.insert('text') // Add text layer of '█'s to erase the area on the path. + let relationDataLabelsEntered = relationDataEntered.filter(d => d.label); + relationDataLabelsEntered.insert('text') // Add text layer of '█'s to erase the area on the path. .attr('dominant-baseline', 'middle') .attr('text-anchor', 'middle') .attr('font-family', 'monospace') @@ -798,7 +800,7 @@ export function D3Blueprint(container, options) { .attr('xlink:href', (d)=>('#' + d.source._id + '-' + d.target._id)) .attr('startOffset', '59%') // 59% roughly reflects `middle of the arch` minus `node radius`. .html((d) => (d.label ? '█'.repeat(d.label.length + 2) : null)); - relationDataEntered.insert('text') // Add label text on top of '█'s which is on top of the path. + relationDataLabelsEntered.insert('text') // Add label text on top of '█'s which is on top of the path. .attr('dominant-baseline', 'middle') .attr('text-anchor', 'middle') .attr('font-family', 'monospace')
