Class: TextArea

TextArea(scene, name, titleText)

Text area somewhere in space, like a screen. Provides methods for writing the text, movement, resizing.

Constructor

new TextArea(scene, name, titleText)

Creates the area with default values. By default, it's sized and positioned to be attached to the camera, is nicely transparent, font size 16 on 512x512 texture, and includes manipulation handles.
Parameters:
Name Type Default Description
scene babylon scene, mandatory
name TextArea optional, defaults to TextArea
titleText null optional title to display above the area
Source:

Classes

TextArea

Members

scrollable

Makes this area scrollable when required, i.e. text does not fit on the area. Must be set before show() is called.
Source:

title :Label

Type:
Source:

Methods

attachToCamera(camera)

Attach it to the camera. It does not resize automatically, just sets the parent. It does not automatically switch to another camera if active camera changes.
Parameters:
Name Type Description
camera currently active camera
Source:

attachToHud()

Attach both textPlane and backgroundPlane to the HUD, and optionally also handles.
Source:

checkCapacity()

Check if current text length exceeds the capacity and truncate as required. For scrollable area, check number of lines and turn on scrollbars if required.
Source:

clear()

Remove the text
Source:

createHandles()

Creates manipulation handles. Left and right handle resize, and top and bottom move it.
Source:

detach()

Detach from whatever attached to, i.e. drop it where you stand.
Source:

dispose()

Clean up.
Source:

dispose()

Clean up allocated resources
Source:

getCurRows()

Calculates and returns current number of rows
Source:

getMaxCols()

Calculates and returns maximum number text columns available
Source:

getMaxRows()

Calculates and returns maximum text rows available
Source:

hide(flag)

Hide/show (requires manipulation handles)
Parameters:
Name Type Description
flag boolean, hide/show
Source:

onClick(callback)

Set click event handler here
Parameters:
Name Type Description
callback executed on pointer click, passed Control argument
Source:

print()

Same as write
Source:

println()

Same as writeln
Source:

removeTitle()

Remove the title, if any.
Source:

show()

As the name says. Optionally also creates manipulation handles.
Source:

showTitle()

Show title text on top of the area. Title can be changed and displayed any time after show().
Source:

write()

Write a string
Source:

writeArray()

Print a number of lines
Source:

writeln()

Print a string into a new line
Source: