Class: LayoutOptions

LayoutOptions

This are the base constraints that you can apply on a PUXI.Widget under any layout manager. It specifies the dimensions of a widget, while the position of the widget is left to the parent to decide. If a dimension (width or height) is set to a value between -1 and 1, then it is interpreted as a percentage of the parent's dimension.

The following example will render a widget at 50% of the parent's width and 10px height:

const widget = new PUXI.Widget();
const parent = new PUXI.Widget();

widget.layoutOptions = new PUXI.LayoutOptions(
     .5,
     10
);
parent.addChild(widget);

new LayoutOptions (width, height)

Name Type Default Description
width number LayoutOptions.WRAP_CONTENT optional
height number LayoutOptions.WRAP_CONTENT optional

Members

height number

Preferred height of the widget in pixels. If its value is between -1 and 1, it is interpreted as a percentage of the parent's height.

Default Value:
  • {PUXI.LayoutOptions.WRAP_CONTENT}

marginBottom number

The bottom margin in pixels of the widget.

Default Value:
  • 0

marginLeft number

The left margin in pixels of the widget.

Default Value:
  • 0

marginRight number

The right margin in pixels of the widget.

Default Value:
  • 0

marginTop number

This top margin in pixels of the widget.

Default Value:
  • 0

width number

Preferred width of the widget in pixels. If its value is between -1 and 1, it is interpreted as a percentage of the parent's width.

Default Value:
  • {PUXI.LayoutOptions.WRAP_CONTENT}