Skip to content

CenterContainer

Eduard Gushchin edited this page Jul 1, 2026 · 3 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.CenterContainer
Namespace Electron2D
Kind class
Category UI and Text

Overview

Places direct child controls around the center of this container.

Syntax

public class Electron2D.CenterContainer : Electron2D.Container

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Supported / Parity verified
Out of profile: no
Godot reference: CenterContainer

UI container that keeps direct child controls at minimum size and positions them around the center.

Remarks

CenterContainer keeps child controls at their combined minimum size. It does not stretch children to the full container rectangle.

Thread Safety

This type is not synchronized. Create and mutate it on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Container

Members

Member Kind Summary
UseTopLeft Property Gets or sets whether the child top-left corner is placed at the center.
Electron2D.CenterContainer() Constructor Initializes a new instance of the Electron2D.CenterContainer type.
_GetMinimumSize() Method Gets the minimum size required by this center container.

Member Details

UseTopLeft

Kind: Property

public System.Boolean UseTopLeft { get; set; }

Summary

Gets or sets whether the child top-left corner is placed at the center.

Remarks

This property affects all direct child controls on the next layout pass.

Value

true to place child top-left corners at the center point; otherwise, false to center full child rectangles.

Thread Safety

This property is not synchronized. Mutate it on the main scene thread.

Since

This property is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Container.QueueSort

Electron2D.CenterContainer()

Kind: Constructor

public Electron2D.CenterContainer()

Summary

Initializes a new instance of the Electron2D.CenterContainer type.

Remarks

The new container centers child rectangles by their full size until Electron2D.CenterContainer.UseTopLeft is enabled.

Thread Safety

This constructor is not synchronized. Call it on the main scene thread.

Since

This constructor is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CenterContainer.UseTopLeft

_GetMinimumSize()

Kind: Method

public Electron2D.Vector2 _GetMinimumSize()()

Summary

Gets the minimum size required by this center container.

Remarks

Centering does not add padding or separation.

Returns

The largest combined minimum size among direct child controls.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CenterContainer.UseTopLeft

Clone this wiki locally