TextSystem

TextSystem ⇐ MRSystem

Handles text creation and font rendering for mr-text, mr-textfield, and mr-textarea with a starting framerate of 1/30.

Kind: global class
Extends: MRSystem

textSystem.TextSystem

Kind: instance class of TextSystem

new exports.TextSystem()

TextSystem’s default constructor

textSystem.onNewEntity(entity)

When a new entity is created, adds it to the physics registry and initializes the physics aspects of the entity.

Kind: instance method of TextSystem

Param Type Description
entity MREntity the entity being set up

textSystem._updateSpecificEntity(entity)

The per entity triggered update call. Handles updating all text items including updates for style and cleaning of content for special characters.

Kind: instance method of TextSystem

Param Type Description
entity object the entity that needs to be updated.

textSystem.checkIfTextContentChanged(entity) ⇒ boolean

Kind: instance method of TextSystem
Returns: boolean - true if the content needed to be updated, false otherwise.

Param Type Description
entity object checks if the content changed and if so, updates it to match.

textSystem.handleTextContentUpdate(entity)

Kind: instance method of TextSystem

Param Type Description
entity object the entity whose content updated.

textSystem.eventUpdate()

The per global scene event update call. Handles updating all text items including updates for style and cleaning of content for special characters.

Kind: instance method of TextSystem

textSystem.updateStyle(entity)

Updates the style for the text’s information based on compStyle and inputted css elements.

Kind: instance method of TextSystem

Param Type Description
entity MRTextEntity the text entity whose style is being updated

textSystem.addText(entity)

Handles when text is added as an entity updating content and style for the internal textObj appropriately.

Kind: instance method of TextSystem

Param Type Description
entity MRTextEntity the text entity being updated

textSystem.parseFontWeight(weight) ⇒ string

parses the font weight as ‘bold’, ‘normal’, etc based on the given weight value

Kind: instance method of TextSystem
Returns: string - - the enum of ‘bold’, ‘normal’, etc

Param Type Description
weight number the numerical representation of the font-weight

textSystem.parseFontSize(val, el) ⇒ number

parses the font size based on its XXpx value and converts it to a usable result based on the virtual display resolution

Kind: instance method of TextSystem
Returns: number - - the font size adjusted for the display as expected

Param Type Description
val number the value being adjusted
el object the css element handler

textSystem.getVerticalAlign(verticalAlign, entity) ⇒ string

Gets the vertical align

Kind: instance method of TextSystem
Returns: string - - the string representation of the the verticalAlign

Param Type Description
verticalAlign number the numerical representation in pixel space of the vertical Align
entity MREntity the entity whose comp style (css) is relevant

textSystem.getLineHeight(lineHeight, entity) ⇒ number

Gets the line height

Kind: instance method of TextSystem
Returns: number - - the numerical representation of the the lineHeight

Param Type Description
lineHeight number the numerical representation in pixel space of the line height
entity MREntity the entity whose comp style (css) is relevant

textSystem.getTextAlign(textAlign) ⇒ string

Gets the text alignment string

Kind: instance method of TextSystem
Returns: string - - the resolved textAlign.

Param Type Description
textAlign string handles values for start, end, left, and right; otherwise, defaults to the same input as textAlign.

textSystem.parseFontFace(cssString) ⇒ object

Based on the given font-face value in the passed cssString, tries to either use by default or download the requested font-face for use by the text object.

Kind: instance method of TextSystem
Returns: object - - json object respresenting the preloaded font-face

Param Type Description
cssString string the css string to be parsed for the font-face css value.

textSystem.setTextObject3DColor(object3D, color, default_color)

Sets the text object3D color.

Kind: instance method of TextSystem

Param Type Description
object3D object the threejs object representation of the troika textt to be colored
color string the string representation of the color in rgba, hex, or name (‘red’) form
default_color string fallback color used if the system does not understand the color parameter. Defaults to black.