Skip to content

@fabwcie/free-drawing / utils/text / getContentWidth

Function: getContentWidth() ​

getContentWidth(text): number

Defined in: packages/free-drawing/src/utils/text.ts:22

Width of a text box fitting its content: longest line as konva measures it, and padding

Parameters ​

text ​

Text

text node, measured with its style (font, size, padding)

Returns ​

number

width in text coordinates, rounded up, 1 at least