Module druid.text
Component to handle all GUI texts.
Druid text can adjust itself for text node size Text will never will be outside of his text size (even multiline)
Functions
init(node[, value[, no_adjust]]) | Component init function |
get_text_width([text]) | Calculate text width with font with respect to trailing space |
set_to(set_to) | Set text to text field |
set_color(color) | Set color |
set_alpha(alpha) | Set alpha |
set_scale(scale) | Set scale |
set_pivot(pivot) | Set text pivot. |
is_multiline() | Return true, if text with line break |
Tables
Events | Component events |
Fields | Component fields |
Functions
- init(node[, value[, no_adjust]])
-
Component init function
Parameters:
- node node Gui text node
- value string Initial text. Default value is node text from GUI scene. (optional)
- no_adjust bool If true, text will be not auto-adjust size (optional)
- get_text_width([text])
-
Calculate text width with font with respect to trailing space
Parameters:
- text string (optional)
- set_to(set_to)
-
Set text to text field
Parameters:
- set_to string Text for node
- set_color(color)
-
Set color
Parameters:
- color vector4 Color for node
- set_alpha(alpha)
-
Set alpha
Parameters:
- alpha number Alpha for node
- set_scale(scale)
-
Set scale
Parameters:
- scale vector3 Scale for node
- set_pivot(pivot)
-
Set text pivot. Text will re-anchor inside
his text area
Parameters:
- pivot gui.pivot Gui pivot constant
- is_multiline()
-
Return true, if text with line break
Returns:
-
bool
Is text node with line break
Tables
- Events
-
Component events
Fields:
- on_set_text druid_event On set text callback
- on_update_text_scale druid_event On adjust text size callback
- on_set_pivot druid_event On change pivot callback
- Fields
-
Component fields
Fields:
- node node Text node
- pos vector3 Current text position
- start_scale vector3 Initial text node scale
- scale vector3 Current text node scale
- start_size vector3 Initial text node size
- text_area vector3 Current text node available are
- is_no_adjust bool Current text size adjust settings
- color vector3 Current text color