Replace string concat with string templates

This commit is contained in:
Matheus B
2023-11-20 21:06:38 -03:00
parent fc3018e977
commit d61bfde167

View File

@@ -69,17 +69,13 @@ const rect = (parent, node) => {
label.attr( label.attr(
'transform', 'transform',
// This puts the labal on top of the box instead of inside it // This puts the labal on top of the box instead of inside it
'translate(' + `translate(${node.x - bbox.width / 2}, ${node.y - node.height / 2 + subGraphTitleTopMargin})`
(node.x - bbox.width / 2) +
', ' +
(node.y - node.height / 2 + subGraphTitleTopMargin) +
')'
); );
} else { } else {
label.attr( label.attr(
'transform', 'transform',
// This puts the labal on top of the box instead of inside it // This puts the labal on top of the box instead of inside it
'translate(' + node.x + ', ' + (node.y - node.height / 2 + subGraphTitleTopMargin) + ')' `translate(${node.x}, ${node.y - node.height / 2 + subGraphTitleTopMargin})`
); );
} }
// Center the label // Center the label