Class: LayoutAlignment

LayoutAlignment

LayoutAlignment

new GOWN.layout.LayoutAlignment()

Basic layout

Extends

Members

static,readonlyGOWN.layout.LayoutAlignment.HORIZONTAL_ALIGNMENTString

Horizontal alignment

static,readonlyGOWN.layout.LayoutAlignment.VERTICAL_ALIGNMENTString

Vertical alignment

firstGapNumber

The space between the first and second element

gapNumber

The space, in pixels, between items.
Default Value:
  • 0

lastGapNumber

The space between the last and second-to-last element

readonlyneedUpdate

Indicates if the layout needs to be rearranged.

paddingNumber

Shortcut to set all paddings (left, right, top, bottom)
Default Value:
  • 0

paddingBottomNumber

The minimum space, in pixels, below the items.
Default Value:
  • 0

paddingLeftNumber

The space, in pixels, that appears to the left, before the first item.
Default Value:
  • 0

paddingTopNumber

The minimum space, in pixels, above the items.
Default Value:
  • 0

Methods

applyFixedPercent(items, explicit, alignment)

Apply percentage width/height to items. This will use the explicit width/height and apply it to all items according to its percentages. Percentages have higher priorities than fixed values. So if you set a width higher than 0 but also percentWidth, the width will be recalculated according to percentWidth.
Name Type Default Description
items Array The items which get new width and height according to the percent
explicit Number The space we have for the components
alignment String LayoutAlignment.VERTICAL_ALIGNMENT optional The alignment mode

applyPercent(items, explicit)

Apply percentage width/height to items. This will stack items on top/aside of each other Percentages have higher priorities than fixed values. So if you set a width higher than 0 but also percentWidth, the width will be recalculated according to percentWidth. (this function will handle padding and gap, so the explicitWidth is for the whole available width)
Name Type Description
items Array The items which get new width and height according to the percent
explicit Number space we have for the components

layout(items, maxWidth, maxHeight)

Position (and possibly resize) the supplied items.
Name Type Description
items Array The items that will be layouted
maxWidth Number The maximum width for the items
maxHeight Number The maximum height for the items
Returns:
Number[] The width and height

layoutContainer(container)

Calculate the layout for a container (and its children)
Name Type Description
container The container to calculate the layout for
Returns:
Number[] The width and height