Class: List

List

Class that represents a PixiJS List.

new List (items, opts)

Creates an instance of a Flippable.

Name Type Description
items Array.<PIXI.DisplayObject>

An array of PIXI.DisplayObjects.

opts object optional

An options object which can contain the following properties.

Name Type Default Description
width number optional

The width of the list. If the items are larger than this width, the overflow will be hidden.

height number optional

The height of the list. If the items are larger than this height, the overflow will be hidden.

padding number 10 optional

The inner spacing (distance from one item to the previous/next item).

margin number 10 optional

The outer spacing (distance from one item to the border).

orientation string vertical optional

The orientation of the button group. Can be horizontal or vertical.

align string left optional

The horizontal position of the items. Possible values are left, center and right.

verticalAlign string middle optional

The vertical position of the items. Possible values are top, middle and bottom.

app PIXI.Application optional

The PixiJS Application. Must be set if you want to use the mousewheel to scroll your list.

See:
Example
const elephant1 = PIXI.Sprite.fromImage('./assets/elephant-1.jpg')
const elephant2 = PIXI.Sprite.fromImage('./assets/elephant-2.jpg')

// Create the list
const list = new List([elephant1, elephant2])

app.scene.addChild(list)

Extends

  • PIXI.Container

Members

innerHeight

innerWidth

Methods

capture (event)

Captures an event to inform InteractionMapper about processed events.

Name Type Description
event event | PIXI.InteractionEvent

The PIXI event to capture.

layout ()List

Should be called to refresh the layout of the list (the width or the height).

Returns:
Type Description
List A reference to the list for chaining.

resize (widthOrHeight)

Resizes the list.

Name Type Description
widthOrHeight number

The new width (if orientation is horizontal) or height (if orientation is vertical) of the list.

setItems (items)List

Replaces the existing items and relayouts the list.

Name Type Description
items Array.<PIXI.DisplayObject>

An array of PIXI.DisplayObjects.

Returns:
Type Description
List A reference to the list for chaining.