Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TextInput

A PIXI TextInput container

Hierarchy

  • Container
    • TextInput

Index

Constructors

Properties

Methods

Object literals

Constructors

constructor

Properties

_accessibleActive

_accessibleActive: boolean
member

{boolean}

memberof

PIXI.DisplayObject#

todo

Needs docs.

_accessibleDiv

_accessibleDiv: boolean
member

{boolean}

memberof

PIXI.DisplayObject#

todo

Needs docs.

Protected _bounds

_bounds: Bounds

The bounds object, this is used to calculate and store the bounds of the displayObject.

member

{PIXI.Bounds} PIXI.DisplayObject#_bounds

Protected _destroyed

_destroyed: boolean

If the object has been destroyed via destroy(). If true, it should not be used.

member

{boolean} PIXI.DisplayObject#_destroyed

Protected _lastSortedIndex

_lastSortedIndex: number

Which index in the children array the display component was before the previous zIndex sort. Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.

member

{number} PIXI.DisplayObject#_lastSortedIndex

Protected _mask

_mask: Graphics | Sprite | null

The original, cached mask of the object.

member

{PIXI.Graphics|PIXI.Sprite|null} PIXI.DisplayObject#_mask

Protected _tempDisplayObjectParent

_tempDisplayObjectParent: DisplayObject
member

{PIXI.DisplayObject}

Protected _zIndex

_zIndex: number

The zIndex of the displayObject. A higher value will mean it will be rendered on top of other displayObjects within the same container.

member

{number} PIXI.DisplayObject#_zIndex

accessible

accessible: boolean

Flag for if the object is accessible. If true AccessibilityManager will overlay a shadow div with attributes set

member

{boolean}

memberof

PIXI.DisplayObject#

accessibleChildren

accessibleChildren: boolean

Setting to false will prevent any children inside this container to be accessible. Defaults to true.

member

{boolean}

memberof

PIXI.DisplayObject#

default

true

accessibleHint

accessibleHint: string

Sets the aria-label attribute of the shadow div

member

{string}

memberof

PIXI.DisplayObject#

accessiblePointerEvents

accessiblePointerEvents: string

Specify the pointer-events the accessible div will use Defaults to auto.

member

{string}

memberof

PIXI.DisplayObject#

default

'auto'

accessibleTitle

accessibleTitle: string

Sets the title attribute of the shadow div If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'

member

{?string}

memberof

PIXI.DisplayObject#

accessibleType

accessibleType: string

Specify the type of div the accessible layer is. Screen readers treat the element differently depending on this type. Defaults to button.

member

{string}

memberof

PIXI.DisplayObject#

default

'button'

alpha

alpha: number

The opacity of the object.

member

{number} PIXI.DisplayObject#alpha

angle

angle: number

The angle of the object in degrees. 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.

member

{number}

Private backgroundComponent

backgroundComponent: Graphics

PIXI Background component on blur

Private backgroundComponentFocus

backgroundComponentFocus: Graphics

PIXI Background component on focus

Private blindStatus

blindStatus: boolean = true

Status of cursor

Private blurEventRef

blurEventRef: any

buttonMode

buttonMode: boolean

If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive Setting this changes the 'cursor' property to 'pointer'.

example

const sprite = new PIXI.Sprite(texture); sprite.interactive = true; sprite.buttonMode = true;

member

{boolean}

memberof

PIXI.DisplayObject#

cacheAsBitmap

cacheAsBitmap: boolean

Set this to true if you want this display object to be cached as a bitmap. This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects. To remove simply set this property to false

IMPORTANT GOTCHA - Make sure that all your textures are preloaded BEFORE setting this property to true as it will take a snapshot of what is currently there. If the textures have not loaded then they will not appear.

member

{boolean}

memberof

PIXI.DisplayObject#

Readonly children

children: DisplayObject[]

The array of children of this container.

member

{PIXI.DisplayObject[]} PIXI.Container#children

readonly

cursor

cursor: string

This defines what cursor mode is used when the mouse cursor is hovered over the displayObject.

example

const sprite = new PIXI.Sprite(texture); sprite.interactive = true; sprite.cursor = 'wait';

see

https://developer.mozilla.org/en/docs/Web/CSS/cursor

member

{string}

memberof

PIXI.DisplayObject#

Private cursorComponentBlind

cursorComponentBlind: Graphics

PIXI Cursor component on focus

Private cursorComponentLow

cursorComponentLow: Graphics

PIXI Cursor component on focus

Private cursorPosition

cursorPosition: number

Actual cursor position

filterArea

filterArea: Rectangle

The area the filter is applied to. This is used as more of an optimization rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.

Also works as an interaction mask.

member

{?PIXI.Rectangle} PIXI.DisplayObject#filterArea

filters

filters: Filter[]

Sets the filters for the displayObject.

  • IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer. To remove filters simply set this property to 'null'.
member

{?PIXI.Filter[]} PIXI.DisplayObject#filters

height

height: number

The height of the Container, setting this will actually modify the scale to achieve the value set

member

{number}

hitArea

hitArea: IHitArea

Interaction shape. Children will be hit first, then this shape will be checked. Setting this will cause this shape to be checked in hit tests rather than the displayObject's bounds.

example

const sprite = new PIXI.Sprite(texture); sprite.interactive = true; sprite.hitArea = new PIXI.Rectangle(0, 0, 100, 100);

member

{PIXI.IHitArea}

memberof

PIXI.DisplayObject#

interactive

interactive: boolean

Enable interaction events for the DisplayObject. Touch, pointer and mouse events will not be emitted unless interactive is set to true.

example

const sprite = new PIXI.Sprite(texture); sprite.interactive = true; sprite.on('tap', (event) => { //handle event });

member

{boolean}

memberof

PIXI.DisplayObject#

interactiveChildren

interactiveChildren: boolean

Determines if the children to the displayObject can be clicked/touched Setting this to false allows PixiJS to bypass a recursive hitTest function

member

{boolean}

memberof

PIXI.Container#

Private interval

interval: number | undefined

Private isFocus

isFocus: boolean = false

true if focus

isMask

isMask: boolean

Does any other displayObject use this object as a mask?

member

{boolean} PIXI.DisplayObject#isMask

isSprite

isSprite: boolean

used to fast check if a sprite is.. a sprite!

member

{boolean} PIXI.DisplayObject#isSprite

Private keyDownEventRef

keyDownEventRef: any

Private lastComponentHeight

lastComponentHeight: number = 0

Readonly localTransform

localTransform: Matrix

Current transform of the object based on local factors: position, scale, other stuff.

member

{PIXI.Matrix}

readonly

mask

mask: Container | MaskData

Sets a mask for the displayObject. A mask is an object that limits the visibility of an object to the shape of the mask applied to it. In PixiJS a regular mask must be a {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it utilities shape clipping. To remove a mask, set this property to null.

For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.

example

const graphics = new PIXI.Graphics(); graphics.beginFill(0xFF3300); graphics.drawRect(50, 250, 100, 100); graphics.endFill();

const sprite = new PIXI.Sprite(texture); sprite.mask = graphics;

todo

At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.

member

{PIXI.Container|PIXI.MaskData}

name

name: string

The instance name of the object.

memberof

PIXI.DisplayObject#

member

{string} name

options

options: InputOption

Option of text input component Need to use @function redraw if Container is already render

Readonly parent

parent: Container

The display object container that contains this display object.

member

{PIXI.Container} PIXI.DisplayObject#parent

readonly

pivot

pivot: IPoint

The pivot point of the displayObject that it rotates around. Assignment by value since pixi-v4.

member

{PIXI.IPoint}

position

position: IPoint

The coordinate of the object relative to the local coordinates of the parent. Assignment by value since pixi-v4.

member

{PIXI.IPoint}

renderable

renderable: boolean

Can this object be rendered, if false the object will not be drawn but the updateTransform methods will still be called.

Only affects recursive calls from parent. You can ask for bounds manually.

member

{boolean} PIXI.DisplayObject#renderable

rotation

rotation: number

The rotation of the object in radians. 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.

member

{number}

scale

scale: IPoint

The scale factor of the object. Assignment by value since pixi-v4.

member

{PIXI.IPoint}

skew

skew: ObservablePoint

The skew factor for the object in radians. Assignment by value since pixi-v4.

member

{PIXI.ObservablePoint}

sortDirty

sortDirty: boolean

Should children be sorted by zIndex at the next updateTransform call. Will get automatically set to true if a new child is added, or if a child's zIndex changes.

member

{boolean} PIXI.Container#sortDirty

sortableChildren

sortableChildren: boolean

If set to true, the container will sort its children by zIndex value when updateTransform() is called, or manually if sortChildren() is called.

This actually changes the order of elements in the array, so should be treated as a basic solution that is not performant compared to other solutions, such as @link https://github.com/pixijs/pixi-display

Also be aware of that this may not work nicely with the addChildAt() function, as the zIndex sorting may cause the child to automatically sorted to another position.

see

PIXI.settings.SORTABLE_CHILDREN

member

{boolean} PIXI.Container#sortableChildren

Private textComponent

textComponent: Text

PIXI text component

transform

transform: Transform

World transform and local transform of this object. This will become read-only later, please do not assign anything there unless you know what are you doing.

member

{PIXI.Transform} PIXI.DisplayObject#transform

visible

visible: boolean

The visibility of the object. If false the object will not be drawn, and the updateTransform function will not be called.

Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.

member

{boolean} PIXI.DisplayObject#visible

width

width: number

The width of the Container, setting this will actually modify the scale to achieve the value set

member

{number}

Readonly worldAlpha

worldAlpha: number

The multiplied alpha of the displayObject.

member

{number} PIXI.DisplayObject#worldAlpha

readonly

Readonly worldTransform

worldTransform: Matrix

Current transform of the object based on world (parent) factors.

member

{PIXI.Matrix}

readonly

Readonly worldVisible

worldVisible: boolean

Indicates if the object is globally visible.

member

{boolean}

readonly

x

x: number

The position of the displayObject on the x axis relative to the local coordinates of the parent. An alias to position.x

member

{number}

y

y: number

The position of the displayObject on the y axis relative to the local coordinates of the parent. An alias to position.y

member

{number}

zIndex

zIndex: number

The zIndex of the displayObject. If a container has the sortableChildren property set to true, children will be automatically sorted by zIndex value; a higher value will mean it will be moved towards the end of the array, and thus rendered on top of other displayObjects within the same container.

member

{number}

Methods

Private AddEvent

  • AddEvent(): void

Private DrawBackground

  • DrawBackground(): void

Private DrawCursor

  • DrawCursor(): void

Private DrawText

  • DrawText(): void

Private GenerateValueDisplay

  • GenerateValueDisplay(): string

Private OnKeyDown

  • OnKeyDown(event: KeyboardEvent): void

Private RemoveEvent

  • RemoveEvent(): void

Protected _calculateBounds

  • _calculateBounds(): void
  • Recalculates the bounds of the object. Override this to calculate the bounds of the specific object (not including children).

    Returns void

_recursivePostUpdateTransform

  • _recursivePostUpdateTransform(): void
  • Recursively updates transform of all objects from the root to this one internal function for toLocal()

    Returns void

Protected _render

  • _render(renderer: Renderer): void
  • To be overridden by the subclasses.

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

addChild

  • addChild<TChildren>(...child: TChildren): TChildren[0]
  • Adds one or more children to the container.

    Multiple items can be added like so: myContainer.addChild(thingOne, thingTwo, thingThree)

    Type parameters

    • TChildren: DisplayObject[]

    Parameters

    • Rest ...child: TChildren

      The DisplayObject(s) to add to the container

    Returns TChildren[0]

    The first child that was added.

addChildAt

  • addChildAt<T>(child: T, index: number): T
  • Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown

    Type parameters

    • T: DisplayObject

    Parameters

    • child: T

      The child to add

    • index: number

      The index to place the child in

    Returns T

    The child that was added.

Private addStringIntoStringAt

  • addStringIntoStringAt(key: string, index: number, value: string): string
  • Parameters

    • key: string

      Key string

    • index: number

      position to add value

    • value: string

      string to add

    Returns string

blur

  • blur(): void

calculateBounds

  • calculateBounds(): void
  • Recalculates the bounds of the container.

    Returns void

Private calculateCursorLocation

  • calculateCursorLocation(): { x: number; y: number }
  • Calculate cursor location in container

    Returns { x: number; y: number }

    • x: number
    • y: number

Private calculateCursorPosition

  • calculateCursorPosition(): { afterCursorLine: string; line: number; metrix: TextMetrics; positionInLine: number }
  • calculate metrix cursor line position in line text after cursor in line

    Returns { afterCursorLine: string; line: number; metrix: TextMetrics; positionInLine: number }

    • afterCursorLine: string
    • line: number
    • metrix: TextMetrics
    • positionInLine: number

calculateValueMetrics

  • calculateValueMetrics(): TextMetrics

changeCursorPosition

  • changeCursorPosition(position: number): boolean
  • Set new cursor position

    Parameters

    • position: number

      position to set

    Returns boolean

Private cursorTimerEvent

  • cursorTimerEvent(): void

destroy

  • destroy(options?: undefined | { baseTexture?: undefined | false | true; children?: undefined | false | true; texture?: undefined | false | true }): void
  • Removes all internal references and listeners as well as removes children from the display list. Do not use a Container after calling destroy.

    Parameters

    • Optional options: undefined | { baseTexture?: undefined | false | true; children?: undefined | false | true; texture?: undefined | false | true }

    Returns void

Private displayBackground

  • displayBackground(focus: boolean): void
  • display background focus or blur

    Parameters

    • focus: boolean

      true if focus

    Returns void

Private displayCursor

  • displayCursor(visible: boolean, blind: boolean, position: { x: number; y: number }): void
  • Change display cursor status

    Parameters

    • visible: boolean

      cursor is visible ?

    • blind: boolean

      cursor is blind ?

    • position: { x: number; y: number }

      cursor position

      • x: number
      • y: number

    Returns void

displayObjectUpdateTransform

  • displayObjectUpdateTransform(): void
  • DisplayObject default updateTransform, does not update children of container. Will crash if there's no parent element.

    memberof

    PIXI.DisplayObject#

    function

    displayObjectUpdateTransform

    Returns void

fireTextChange

  • fireTextChange(lastValue: string, newValue: string, cursorPosition: number): void
  • Update text

    Parameters

    • lastValue: string

      last value

    • newValue: string

      new value

    • cursorPosition: number

      new cursor position after change

    Returns void

focus

  • focus(): void

getBounds

  • getBounds(skipUpdate?: undefined | false | true, rect?: PIXI.Rectangle): Rectangle
  • Retrieves the bounds of the displayObject as a rectangle object.

    Parameters

    • Optional skipUpdate: undefined | false | true
    • Optional rect: PIXI.Rectangle

    Returns Rectangle

    The rectangular bounding area.

getChildAt

  • getChildAt(index: number): DisplayObject
  • Returns the child at the specified index

    Parameters

    • index: number

      The index to get the child at

    Returns DisplayObject

    The child at the given index, if any.

getChildByName

  • getChildByName(name: string): DisplayObject
  • Returns the display object in the container.

    method

    getChildByName

    memberof

    PIXI.Container#

    Parameters

    • name: string

      Instance name.

    Returns DisplayObject

    The child with the specified name.

getChildIndex

  • getChildIndex(child: DisplayObject): number
  • Returns the index position of a child DisplayObject instance

    Parameters

    • child: DisplayObject

      The DisplayObject instance to identify

    Returns number

    The index position of the child display object to identify

getGlobalPosition

  • getGlobalPosition(point?: PIXI.Point, skipUpdate?: undefined | false | true): Point
  • Returns the global position of the displayObject. Does not depend on object scale, rotation and pivot.

    method

    getGlobalPosition

    memberof

    PIXI.DisplayObject#

    Parameters

    • Optional point: PIXI.Point
    • Optional skipUpdate: undefined | false | true

    Returns Point

    The updated point.

getLocalBounds

  • getLocalBounds(rect?: PIXI.Rectangle): Rectangle
  • Retrieves the local bounds of the displayObject as a rectangle object.

    Parameters

    • Optional rect: PIXI.Rectangle

    Returns Rectangle

    The rectangular bounding area.

off

  • off(event: "added" | "removed" | string, fn?: Function, context?: any): this
  • Parameters

    • event: "added" | "removed" | string
    • Optional fn: Function
    • Optional context: any

    Returns this

on

  • on(event: "added" | "removed", fn: (displayObject: DisplayObject) => void, context?: any): this
  • on(event: string, fn: Function, context?: any): this
  • Parameters

    • event: "added" | "removed"
    • fn: (displayObject: DisplayObject) => void
        • (displayObject: DisplayObject): void
        • Parameters

          • displayObject: DisplayObject

          Returns void

    • Optional context: any

    Returns this

  • Parameters

    • event: string
    • fn: Function
    • Optional context: any

    Returns this

Protected onChildrenChange

  • onChildrenChange(): void
  • Overridable method that can be used by Container subclasses whenever the children array is modified

    Returns void

once

  • once(event: "added" | "removed", fn: (displayObject: DisplayObject) => void, context?: any): this
  • once(event: string, fn: Function, context?: any): this
  • Parameters

    • event: "added" | "removed"
    • fn: (displayObject: DisplayObject) => void
        • (displayObject: DisplayObject): void
        • Parameters

          • displayObject: DisplayObject

          Returns void

    • Optional context: any

    Returns this

  • Parameters

    • event: string
    • fn: Function
    • Optional context: any

    Returns this

redraw

  • redraw(): void
  • Redraw background - text or cursor to andle option change

    Returns void

removeChild

  • removeChild<TChildren>(...child: TChildren): TChildren[0]
  • Removes one or more children from the container.

    Type parameters

    • TChildren: DisplayObject[]

    Parameters

    • Rest ...child: TChildren

      The DisplayObject(s) to remove

    Returns TChildren[0]

    The first child that was removed.

removeChildAt

  • removeChildAt(index: number): DisplayObject
  • Removes a child from the specified index position.

    Parameters

    • index: number

      The index to get the child from

    Returns DisplayObject

    The child that was removed.

removeChildren

  • removeChildren(beginIndex?: undefined | number, endIndex?: undefined | number): DisplayObject[]
  • Removes all children from this container that are within the begin and end indexes.

    Parameters

    • Optional beginIndex: undefined | number
    • Optional endIndex: undefined | number

    Returns DisplayObject[]

    List of removed children

render

  • render(renderer: Renderer): void
  • Renders the object using the WebGL renderer

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

Protected renderAdvanced

  • renderAdvanced(renderer: Renderer): void
  • Render the object using the WebGL renderer and advanced features.

    Parameters

    • renderer: Renderer

      The renderer

    Returns void

Private replaceCharIntoStringAt

  • replaceCharIntoStringAt(key: string, index: number, value: string): string
  • Parameters

    • key: string

      Key string

    • index: number

      position to replace char

    • value: string

      string to replace

    Returns string

setChildIndex

  • setChildIndex(child: DisplayObject, index: number): void
  • Changes the position of an existing child in the display object container

    Parameters

    • child: DisplayObject

      The child DisplayObject instance for which you want to change the index number

    • index: number

      The resulting index number for the child display object

    Returns void

setParent

  • setParent(container: Container): Container
  • Set the parent Container of this DisplayObject.

    Parameters

    • container: Container

      The Container to add this DisplayObject to.

    Returns Container

    The Container that this DisplayObject was added to.

setTransform

  • setTransform(x?: undefined | number, y?: undefined | number, scaleX?: undefined | number, scaleY?: undefined | number, rotation?: undefined | number, skewX?: undefined | number, skewY?: undefined | number, pivotX?: undefined | number, pivotY?: undefined | number): DisplayObject
  • Convenience function to set the position, scale, skew and pivot at once.

    Parameters

    • Optional x: undefined | number
    • Optional y: undefined | number
    • Optional scaleX: undefined | number
    • Optional scaleY: undefined | number
    • Optional rotation: undefined | number
    • Optional skewX: undefined | number
    • Optional skewY: undefined | number
    • Optional pivotX: undefined | number
    • Optional pivotY: undefined | number

    Returns DisplayObject

    The DisplayObject instance

sortChildren

  • sortChildren(): void
  • Sorts children by zIndex. Previous order is mantained for 2 children with the same zIndex.

    Returns void

swapChildren

  • swapChildren(child: DisplayObject, child2: DisplayObject): void
  • Swaps the position of 2 Display Objects within this container.

    Parameters

    • child: DisplayObject

      First display object to swap

    • child2: DisplayObject

      Second display object to swap

    Returns void

toGlobal

  • toGlobal(position: IPoint, point?: PIXI.IPoint, skipUpdate?: undefined | false | true): IPoint
  • Calculates the global position of the display object.

    Parameters

    • position: IPoint

      The world origin to calculate from.

    • Optional point: PIXI.IPoint
    • Optional skipUpdate: undefined | false | true

    Returns IPoint

    A point object representing the position of this object.

toLocal

  • toLocal(position: IPoint, from?: PIXI.DisplayObject, point?: PIXI.IPoint, skipUpdate?: undefined | false | true): IPoint
  • Calculates the local position of the display object relative to another point.

    Parameters

    • position: IPoint

      The world origin to calculate from.

    • Optional from: PIXI.DisplayObject
    • Optional point: PIXI.IPoint
    • Optional skipUpdate: undefined | false | true

    Returns IPoint

    A point object representing the position of this object

updateTransform

  • updateTransform(): void
  • Updates the transform on all children of this container for rendering

    Returns void

useKeyboardPosition

  • useKeyboardPosition(keyCode: number): void
  • Parameters

    • keyCode: number

      Keycode: 37 for right 38 for up 39 for left 40 for bottom

    Returns void

Static mixin

  • mixin(source: any): void
  • Mixes all enumerable properties and methods from a source object to DisplayObject.

    Parameters

    • source: any

      The source of properties and methods to mix in.

    Returns void

Object literals

Private cursorWorldPosition

cursorWorldPosition: object

Actual cursor position in the world

x

x: number = 0

y

y: number = 0