Creates an instance of a Modal.
Name | Type | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
object |
optional
An options object to specify to style and behaviour of the modal.
|
- See:
Example
// Create the button and the modal when clicked
const button = new Button({
label: 'Show Modal',
action: e => {
const modal = new Modal({
app: app,
header: 'This is the header',
content: 'This is the text.'
})
app.scene.addChild(modal)
}
})
// Add the button to a DisplayObject
app.scene.addChild(button)
Extends
- PIXI.Container
- InteractivePopup
Members
-
Sets or gets the content. The getter always returns an PIXI.DisplayObject. The setter can receive a string or a PIXI.DisplayObject.
-
Sets or gets the header. The getter always returns a PIXI.Text object. The setter can receive a string or a PIXI.Text object.
Methods
-
hide ()Modal
-
Hides the modal (sets his alpha values to 0).
Returns:
Type Description Modal A reference to the modal for chaining. -
Should be called to refresh the layout of the modal. Can be used after resizing.
Returns:
Type Description Modal A reference to the modal for chaining. -
show ()Modal
-
Shows the modal (sets his alpha values to 1).
Returns:
Type Description Modal A reference to the modal for chaining.