Text
Extends:
A Text Box allows for text to be displayed on a Box element. The text can be multiline containing \n caracters. A Text object is created by calling the method Box.addText on the parent Box.
Constructor Summary
Public Constructor | ||
public |
constructor(box: Box, width: number, height: number, opts: object) |
Member Summary
Public Members | ||
public |
Sets the parent box where te Text will be placed. |
|
public |
Sets the height of the Text in pixels. |
|
public |
Contains the string to be displayed separated by every \n character. |
|
public |
Sets the width of the Text in pixels. |
Method Summary
Public Methods | ||
public |
Sets the text that will be displayed. |
Private Methods | ||
private |
debug() Debug function used to draw a box around the dimensions of the text object. |
|
private |
draw() Draw function for the Text called by the parent box. |
Inherited Summary
From class WorldElement | ||
public |
Sets the color in HEX format of the element. |
|
public |
Sets the cursor style when the mouse is over the element. |
|
public |
Flag for enabling or diabling this element. |
|
public |
Flag set when the element is being dragged around. |
|
public |
Sets the font of the element. |
|
public |
Sets the current height of the element. |
|
public |
Flag for allowing the element to be dragged around. |
|
public |
Sets the move style of the element. |
|
public |
Flag set when the mouse is over the element. |
|
public |
Sets a callback function for when the element is dragged around. |
|
public |
Sets the position of the element. |
|
public |
Sets the renderer used for the element. |
|
public |
Sets the rotation of the element. |
|
public |
A copy of the z-index value is stored here. |
|
public |
Sets the drawing scale of the element. |
|
public |
Flag for determining if the element will be a top-most element when dragged around. |
|
public |
Flag used to determine if an object is a child of WorldElement. |
|
public |
Sets the current width of the element. |
|
public |
Sets the world where this element is found. |
|
public |
Sets the z-index of the element. |
|
public |
addPosition(x: number, y: number) Adds the provided coordinates to the position. |
|
public |
Sets if the element is draggable. |
|
public |
Function called when the mouse moves to check if the pointer is over the element. |
|
public |
Sets the color in HEX format of the element. |
|
public |
setPosition(x: number, y: number) Sets the position of the element. |
|
public |
Sets the scale of the element. |
|
public |
Sets the z-index of the element. |
|
private |
resize() Function called when the canvas gets resized. |
|
private |
Sets the world object where element will be drawn. |
|
private |
Sets the element as a topmost element. |
Public Constructors
public constructor(box: Box, width: number, height: number, opts: object) source
Override:
WorldElement#constructorParams:
Name | Type | Attribute | Description |
box | Box | Parent box. |
|
width | number | Width of the text in pixels. |
|
height | number | Height of the text in pixels. |
|
opts | object |
|
Object that contains valid Text properties with values. Their values will be assigned at the end of the constructor. If an invalid property is passed then the value will be ignored. |
Public Members
Public Methods
public setText(rawText: string) source
Sets the text that will be displayed. The text can have multiple lines.
Params:
Name | Type | Attribute | Description |
rawText | string | Text to be displayed. |