WrapText node


Display the text of the string field using automatic wrap to fit in maxWidth pixels width and using a maximum of maxLines lines of text.
If a word is wider than maxWidth (in pixels), it is split it two lines (or more) and a '-' character will be added a the end of the line.
If the text cannot fit entirely in the maxLines limit, it is cropped and "..." is displayed at the end of the text.

Each time the fields string, fontStyle, maxWidth, maxLines, maxSize, editable are changed, the wrap algorithm recomputes the text layout.


Editing features

Since the version 1.4.1, the WrapText is able to display a cursor and handle multi-line or single-line edition by allowing the text to scroll in a clipped box.

When editable is TRUE, the text will display with the following rules:

The following animations illustrates how the WrapText handles scrolling based on the cursor position:


1.4.1

Changes:

New field: maxSize, editable, set_cursor, cursor_changed.

Deprecated fields: maxWidth.


MFString string []:
All string items of the field are concatenated.

SFNode fontStyle NULL:
Same as the Text.fontstyle field, this field uses a FontStyle node to customize font appearance.

SFVec2f size_changed 0 0:
Each time the wrap algorithm computes the text layout, this field emits the new size of the bounding box of the text.

SFInt32 maxWidth 0:
If greater than 0, limit the width of the text to this value (in pixels). Default: 0 (no limit).
Deprecated since 1.4.1, use maxSize.x.

SFInt32 maxLines 0:
If greater than 0; limit the max number of lines to this value. Default: 0 (no limit).

SFVec2f maxSize 0 0:
If maxSize.y is greater than 0, limit the max number of lines to keep under the maxSize.y pixel height.
If maxSize.x is greater than 0, limit the with of the text to keep under the maxSize.x pixel width.
Default: 0 0 (no limit).
Since 1.4.1

SFBool editable FALSE:
If TRUE, a cursor is displayed and text can be scrolled horizontally or verticaly (see Editing features section above).
Since 1.4.1

SFInt32 set_cursor 0:
When editable is TRUE, set_cursor can be set between 0 and the max number of characters given to string.
To jump to the next line, use the -2 value.
To jump to the previous line, use the -1 value.
Since 1.4.1

SFInt32 cursor_changed 0:
When the cursor changes position, either after a set_cursor event, when the text is updated (e.g. if the text is shorter than the current cursor position) or after a touch event to move the cursor, the cursor_changed will fire an event.
Since 1.4.1