Class: PopupMenu

PopupMenu

Class that represents a PixiJS PopupMenu.

new PopupMenu (opts)

Creates an instance of a PopupMenu.

Name Type Description
opts object optional

An options object to specify to style and behaviour of the modal.

Name Type Default Description
items Array.<object> [] optional

A list of the menu items. Each item must be of type object. If an object has a label property, a PIXI.Text object is created (using the textStyle property). If an object hasn't a label property, it must contain a content property which has to be a PIXI.DisplayObject.

margin number Theme.margin / 2 optional

The app where the modal belongs to.

textStyle object Theme.textStyle optional

The color of the background.

closeOnPopup boolean true optional

The opacity of the background.

See:
Example
// Create the button and the modal when clicked
const button = new Button({
    label: 'Show PopupMenu',
    action: e => {
        const popupmenu = new PopupMenu({
            items: [
                {label: 'Save', action: () => alert('Saved')},
                {label: 'Edit', action: () => alert('Edited')},
                {label: 'Delete', action: () => alert('Deleted')}
            ]
        })
        app.scene.addChild(popupmenu)
    }
})

// Add the button to a DisplayObject
app.scene.addChild(button)

Extends

Classes

InteractivePopup
InteractivePopup
InteractivePopup
InteractivePopup

Members

content string | number | PIXI.DisplayObject inherited overrides

Sets or gets the content. The getter always returns an PIXI.DisplayObject. The setter can receive a string, a number or a PIXI.DisplayObject.

Sets or gets the header. The getter always returns a PIXI.Text object. The setter can receive a string, a number or a PIXI.Text object.

Methods

Hides the popup (sets his alpha values to 0).

Name Type Description
cb callback optional

Executed when hide animation was completed.

Returns:
Type Description
AbstractPopup A reference to the popup for chaining.

Should be called to refresh the layout of the popup. Can be used after resizing.

Returns:
Type Description
AbstractPopup A reference to the popup for chaining.

Shows the popup (sets his alpha values to 1).

Name Type Description
cb callback optional

Executed when show animation was completed.

Returns:
Type Description
AbstractPopup A reference to the popup for chaining.