Class: LabeledGraphics

LabeledGraphics

new LabeledGraphics ()

A specialization of the PIXI.Graphics class that allows to resuse and place labels across different layout variants

Extends

  • PIXI.Graphics

Classes

exports.LabeledGraphics

Methods

Ensures that labels are hidden on clear.

debugInfos ()

Logs debugging infos

ensureLabel (key, label, attrs, fontInfo)PIXI.Text

Main additional method. Ensures that a text object is created that is cached under the given key.

Name Type Default Description
key *

The cache key

label *

The label to show

attrs * {} optional

Defines attributes of the text object. align: 'right', 'left', or 'center' justify: 'top', 'bottom', or 'center' maxLines: {integer} truncates the text and adds ellipsis maxHeight: {number} truncates text that needs more space and adds ellipsis maxWidth: {number} word wraps text using hyphenation if possible

fontInfo * FontInfo.normal optional

Defines PIXI.TextStyle attributes

Returns:
Type Description
PIXI.Text
  • instance

getLabel (key)Object

Returns the label for the given key.

Name Type Description
key *
Returns:
Type Description
Object

hideLabel (key)

Hides the label with the given key.

Name Type Description
key *

removeLabel (key)

Removes the label with the given key.

Name Type Description
key *

truncateLabel (text, style, maxLines)string

Private method that truncates the text and adds an ellipsis if there are more lines than wanted

Name Type Default Description
text *
style *
maxLines * Infinity optional
Returns:
Type Description
string