Adjust the label a little
Some checks failed
Deploy to GitHub Pages / build (push) Has been cancelled
Deploy to GitHub Pages / deploy (push) Has been cancelled

This commit is contained in:
gbanyan
2025-12-16 11:18:50 +08:00
parent 7c2a624130
commit f86cf3b887

View File

@@ -446,13 +446,15 @@ function renderPersons(
.attr('fill', 'none');
}
// Label
// Label (positioned below connection lines)
// Vertical lines to children end at childY - halfSymbol = parentY + verticalSpacing - 20 = parentY + 80
// So label must be > 80 to avoid overlap. Using 85.
if (options.showLabels && person.metadata.label) {
personGroup
.append('text')
.attr('class', 'person-label')
.attr('x', 0)
.attr('y', options.symbolSize / 2 + 15)
.attr('y', options.symbolSize / 2 + 65)
.attr('text-anchor', 'middle')
.attr('font-size', '12px')
.attr('font-family', 'sans-serif')
@@ -465,7 +467,7 @@ function renderPersons(
.append('text')
.attr('class', 'person-id')
.attr('x', 0)
.attr('y', options.symbolSize / 2 + 15)
.attr('y', options.symbolSize / 2 + 65)
.attr('text-anchor', 'middle')
.attr('font-size', '11px')
.attr('font-family', 'sans-serif')