API Docs for:
Show:

Component_StackLayoutBehavior Class

Module: gs

Turns a game object into a stack-layout and layouts all sub-objects like stack vertically or horizontally. The game object needs a container-component.
The sub-objects in a stack-layout can be configured as resizable or non-resizable(fixed-size). For example:

Lets say we have a layout-size of 500px in width with three controls.

| 80px | dynamic | 80px |

Two controls have a fixed size of 80px and the middle-control has a dynamic-size because it is configured to be resizable. In that case, the size of the resizable control would be 340px because that is the free space left after subtracting the size(160px) of the fixed-size controls.

In addition, each sub-object can have different alignment options.

Methods

calculateDynamicSizeHorizontal

() Number protected

Calculates the dynamic-size of a horizontal stack-layout. That size is used for resizable-controls to let them fill all free space. It is calculated in the following way:

dynamic-size = sum-of-all-fixed-control-sizes / count-of-resizable-controls

Returns:

Number:

The dynamic size.

calculateDynamicSizeVertical

() Number protected

Calculates the dynamic-size of a vertical stack-layout. That size is used for resizable-controls to let them fill all free space. It is calculated in the following way:

dynamic-size = sum-of-all-fixed-control-sizes / count-of-resizable-controls

Returns:

Number:

The dynamic size.

layoutHorizontal

()

Layouts the sub-objects horizontally.

layoutVertical

()

Layouts the sub-objects vertically.

setup

()

Initializes the layout.

sizeToFit

()

Sizes the layout to fit its content

Returns:

number The content size.

sizeToFitHorizontal

()

Sizes the horizontal-layout to fit its content

sizeToFitVertical

()

Sizes the vertical-layout to fit its content

update

()

Updates the layout depending on its orientation.

updateControl

(
  • control
)
protected

Updates a control.

Parameters:

  • control gs.Object_Base

    The control to update.

updateControlRectFixedH

(
  • control
)
protected

Layouts the specified control as fixed-size control for a horizontal stack-layout.

Parameters:

  • control gs.Object_Base

    The control to update.

updateControlRectFixedV

(
  • control
)
protected

Layouts the specified control as fixed-size control for a vertical stack-layout.

Parameters:

  • control gs.Object_Base

    The control to update.

updateControlRectResizableH

(
  • control
)
protected

Layouts the specified control as resizable-control for a horizontal stack-layout. That means the control will take up all free space after subtracting all fixed-size controls.

Parameters:

  • control gs.Object_Base

    The control to update.

updateControlRectResizableV

(
  • control
)
protected

Layouts the specified control as resizable-control for a vertical stack-layout. That means the control will take up all free space after subtracting all fixed-size controls.

Parameters:

  • control gs.Object_Base

    The control to update.

Properties

bottom

Number protected

Current x/y-coordinate for a bottom/right aligned control.

center

Number protected

Current x/y-coordinate for a centered control.

centerSize

Number protected

Total size of all centered controls.

contentHeight

Number protected

contentHeight

Number protected

Count of controls to process.

cx

Number protected

Current x-coordinate.

cy

Number protected

Current y-coordinate.

offset

Number protected

Control list-offset.

orientation

gs.Orientation

The orientation of the stack-layout. Can be vertical or horizontal.

scrollOffsetX

Number protected

scrollOffsetY

Number protected