FUILayout
extends FUIView
in package
Table of Contents
Properties
- $alignment : FUILayoutAlignment
- The layouts alignment of its children
- $backgroundColor : VGColor|null
- Background color of the view
- $children : array<string|int, FUIView>
- An array of child views
- $cornerRadius : float
- Border radius of the view
- $flow : FUILayoutFlow
- The layouts flow direction for its children
- $height : float|null
- The layouts height This can represent a: - `fixed` value in effective pixels
- $padding : Vec4
- Padding is represented as a Vec4 x = left padding y = right padding z = top padding w = bottom padding
- $sizingHorizontal : FUILayoutSizing
- Horizontal sizing mode
- $sizingVertical : FUILayoutSizing
- Vertical sizing mode
- $spacing : float
- A vertical gap between the children
- $width : float|null
- The layouts width This can represent a: - `fixed` value in effective pixels
Methods
- __construct() : mixed
- Constructs a new view
- backgroundColor() : self
- Sets the background color of the view
- fixedHeight() : self
- Sets the a fixed height for the layout Note: This will override the vertical sizing mode
- fixedWidth() : self
- Sets the a fixed width for the layout Note: This will override the horizontal sizing mode
- flow() : self
- Sets the layout flow direction
- getEstimatedSize() : Vec2
- Returns the height of the current view and its children
- horizontalFill() : self
- Sets the horizontal sizing mode to `fill`
- horizontalFit() : self
- Sets the horizontal sizing mode to `fit`
- horizontalSizing() : self
- Sets the horizontal sizing mode
- padding() : self
- Sets the views padding Padding is the space inside the view to its content
- paddingAll() : self
- Sets all padding values to the same value Padding is the space inside the view to its content
- paddingBottom() : self
- Sets the views bottom padding Padding is the space inside the view to its content
- paddingFull() : self
- Sets the views padding with individual values Padding is the space inside the view to its content
- paddingLeft() : self
- Sets the views left padding Padding is the space inside the view to its content
- paddingRight() : self
- Sets the views right padding Padding is the space inside the view to its content
- paddingTop() : self
- Sets the views top padding Padding is the space inside the view to its content
- paddingX() : self
- Sets the views horizontal padding (left and right) Padding is the space inside the view to its content
- paddingY() : self
- Sets the views vertical padding (top and bottom) Padding is the space inside the view to its content
- render() : void
- Renders the current view using the provided context
- spacing() : self
- Sets the vertical spacing between the children
- verticalFill() : self
- Sets the horizontal sizing mode to `fill`
- verticalFit() : self
- Sets the horizontal sizing mode to `fit`
- verticalSizing() : self
- Sets the vertical sizing mode
- renderContent() : void
- calculateChildrenSizes() : array<string|int, Vec2>
- Calculate the sizes of all children based on their sizing modes This implements Figma-style fill behavior where fill children share available space equally
Properties
$alignment
The layouts alignment of its children
public
FUILayoutAlignment
$alignment
= \VISU\FlyUI\FUILayoutAlignment::topLeft
$backgroundColor
Background color of the view
public
VGColor|null
$backgroundColor
= null
$children
An array of child views
public
array<string|int, FUIView>
$children
= []
$cornerRadius
Border radius of the view
public
float
$cornerRadius
= 0.0
$flow
The layouts flow direction for its children
public
FUILayoutFlow
$flow
= \VISU\FlyUI\FUILayoutFlow::vertical
$height
The layouts height This can represent a: - `fixed` value in effective pixels
public
float|null
$height
= null
$padding
Padding is represented as a Vec4 x = left padding y = right padding z = top padding w = bottom padding
public
Vec4
$padding
$sizingHorizontal
Horizontal sizing mode
public
FUILayoutSizing
$sizingHorizontal
= \VISU\FlyUI\FUILayoutSizing::fill
Should the view be sized to fit its content or fill the available space
$sizingVertical
Vertical sizing mode
public
FUILayoutSizing
$sizingVertical
= \VISU\FlyUI\FUILayoutSizing::fit
Should the view be sized to fit its content or fill the available space
$spacing
A vertical gap between the children
public
float
$spacing
= 0.0
$width
The layouts width This can represent a: - `fixed` value in effective pixels
public
float|null
$width
= null
Methods
__construct()
Constructs a new view
public
__construct([Vec4|null $padding = null ]) : mixed
Parameters
- $padding : Vec4|null = null
backgroundColor()
Sets the background color of the view
public
backgroundColor(VGColor $color[, float|null $cornerRadius = null ]) : self
Parameters
- $color : VGColor
- $cornerRadius : float|null = null
Return values
selffixedHeight()
Sets the a fixed height for the layout Note: This will override the vertical sizing mode
public
fixedHeight(float $height) : self
Parameters
- $height : float
Return values
selffixedWidth()
Sets the a fixed width for the layout Note: This will override the horizontal sizing mode
public
fixedWidth(float $width) : self
Parameters
- $width : float
Return values
selfflow()
Sets the layout flow direction
public
flow(FUILayoutFlow $flow) : self
Parameters
- $flow : FUILayoutFlow
Return values
selfgetEstimatedSize()
Returns the height of the current view and its children
public
getEstimatedSize(FUIRenderContext $ctx) : Vec2
Note: This is used for layouting in some sizing modes
Parameters
- $ctx : FUIRenderContext
Return values
Vec2horizontalFill()
Sets the horizontal sizing mode to `fill`
public
horizontalFill() : self
Return values
selfhorizontalFit()
Sets the horizontal sizing mode to `fit`
public
horizontalFit() : self
Return values
selfhorizontalSizing()
Sets the horizontal sizing mode
public
horizontalSizing(FUILayoutSizing $sizing) : self
Parameters
- $sizing : FUILayoutSizing
Return values
selfpadding()
Sets the views padding Padding is the space inside the view to its content
public
padding(float $horizontal, float $vertical) : self
Parameters
- $horizontal : float
- $vertical : float
Return values
selfpaddingAll()
Sets all padding values to the same value Padding is the space inside the view to its content
public
paddingAll(float $padding) : self
Parameters
- $padding : float
Return values
selfpaddingBottom()
Sets the views bottom padding Padding is the space inside the view to its content
public
paddingBottom(float $paddingBottom) : self
Parameters
- $paddingBottom : float
Return values
selfpaddingFull()
Sets the views padding with individual values Padding is the space inside the view to its content
public
paddingFull(float $left, float $right, float $top, float $bottom) : self
Parameters
- $left : float
- $right : float
- $top : float
- $bottom : float
Return values
selfpaddingLeft()
Sets the views left padding Padding is the space inside the view to its content
public
paddingLeft(float $paddingLeft) : self
Parameters
- $paddingLeft : float
Return values
selfpaddingRight()
Sets the views right padding Padding is the space inside the view to its content
public
paddingRight(float $paddingRight) : self
Parameters
- $paddingRight : float
Return values
selfpaddingTop()
Sets the views top padding Padding is the space inside the view to its content
public
paddingTop(float $paddingTop) : self
Parameters
- $paddingTop : float
Return values
selfpaddingX()
Sets the views horizontal padding (left and right) Padding is the space inside the view to its content
public
paddingX(float $paddingX) : self
Parameters
- $paddingX : float
Return values
selfpaddingY()
Sets the views vertical padding (top and bottom) Padding is the space inside the view to its content
public
paddingY(float $paddingY) : self
Parameters
- $paddingY : float
Return values
selfrender()
Renders the current view using the provided context
public
render(FUIRenderContext $ctx) : void
Parameters
- $ctx : FUIRenderContext
spacing()
Sets the vertical spacing between the children
public
spacing(float $spacing) : self
Parameters
- $spacing : float
Return values
selfverticalFill()
Sets the horizontal sizing mode to `fill`
public
verticalFill() : self
Return values
selfverticalFit()
Sets the horizontal sizing mode to `fit`
public
verticalFit() : self
Return values
selfverticalSizing()
Sets the vertical sizing mode
public
verticalSizing(FUILayoutSizing $sizing) : self
Parameters
- $sizing : FUILayoutSizing
Return values
selfrenderContent()
protected
renderContent(FUIRenderContext $ctx) : void
Parameters
- $ctx : FUIRenderContext
calculateChildrenSizes()
Calculate the sizes of all children based on their sizing modes This implements Figma-style fill behavior where fill children share available space equally
private
calculateChildrenSizes(FUIRenderContext $ctx) : array<string|int, Vec2>
Parameters
- $ctx : FUIRenderContext