MCPcopy Index your code
hub / github.com/loggerhead/json4u / setText

Method setText

src/lib/table/tableNode.ts:91–102  ·  view source on GitHub ↗
(t: string)

Source from the content-addressed store, hash-verified

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;

Callers 3

createNodeFunction · 0.80
createArrayNodeFunction · 0.80
createObjectNodeFunction · 0.80

Calls 1

computeTextWidthFunction · 0.90

Tested by

no test coverage detected