@@ -36,7 +36,7 @@ function drawActorLegend(diagram) {
36
36
37
37
// First, measure the full text width without wrapping.
38
38
let measureText = diagram . append ( 'text' ) . attr ( 'visibility' , 'hidden' ) . text ( person ) ;
39
- const fullTextWidth = measureText . node ( ) . getBBox ( ) . width ;
39
+ const fullTextWidth = measureText . node ( ) . getBoundingClientRect ( ) . width ;
40
40
measureText . remove ( ) ;
41
41
42
42
let lines = [ ] ;
@@ -54,7 +54,7 @@ function drawActorLegend(diagram) {
54
54
// check the width of the line with the new word.
55
55
const testLine = currentLine ? `${ currentLine } ${ word } ` : word ;
56
56
measureText . text ( testLine ) ;
57
- const textWidth = measureText . node ( ) . getBBox ( ) . width ;
57
+ const textWidth = measureText . node ( ) . getBoundingClientRect ( ) . width ;
58
58
59
59
if ( textWidth > maxLabelWidth ) {
60
60
// If adding the new word exceeds max width, push the current line.
@@ -65,12 +65,12 @@ function drawActorLegend(diagram) {
65
65
66
66
// If the word itself is too long, break it with a hyphen.
67
67
measureText . text ( word ) ;
68
- if ( measureText . node ( ) . getBBox ( ) . width > maxLabelWidth ) {
68
+ if ( measureText . node ( ) . getBoundingClientRect ( ) . width > maxLabelWidth ) {
69
69
let brokenWord = '' ;
70
70
for ( const char of word ) {
71
71
brokenWord += char ;
72
72
measureText . text ( brokenWord + '-' ) ;
73
- if ( measureText . node ( ) . getBBox ( ) . width > maxLabelWidth ) {
73
+ if ( measureText . node ( ) . getBoundingClientRect ( ) . width > maxLabelWidth ) {
74
74
// Push the broken part with a hyphen.
75
75
lines . push ( brokenWord . slice ( 0 , - 1 ) + '-' ) ;
76
76
brokenWord = char ;
@@ -102,7 +102,7 @@ function drawActorLegend(diagram) {
102
102
103
103
// Draw the text and measure the width.
104
104
const textElement = svgDraw . drawText ( diagram , labelData ) ;
105
- const lineWidth = textElement . node ( ) . getBBox ( ) . width ;
105
+ const lineWidth = textElement . node ( ) . getBoundingClientRect ( ) . width ;
106
106
107
107
// Use conf.leftMargin as the initial spacing baseline,
108
108
// but expand maxWidth if the line is wider.
0 commit comments