(t: string)
| 89 | |
| 90 | // Sets the text content of the node and calculates its initial width based on the text length. |
| 91 | setText(t: string) { |
| 92 | this.text = t; |
| 93 | |
| 94 | if (t) { |
| 95 | // 1 is border width |
| 96 | const width = computeTextWidth(t, globalStyle.fontWidth) + globalStyle.padding + 1; |
| 97 | this.width = Math.min(width, globalStyle.maxCellWidth); |
| 98 | } else { |
| 99 | this.width = 0; |
| 100 | } |
| 101 | return this; |
| 102 | } |
| 103 | |
| 104 | setWidth(w: number) { |
| 105 | this.width = w; |
no test coverage detected