Table of Contents

Class RootElement

Namespace
MLEM.Ui
Assembly
MLEM.Ui.dll

A root element is a wrapper around an Element that contains additional data. Root elements are only used for the element in each element tree that doesn't have a Parent To create a new root element, use Add(string, Element)

public class RootElement : GenericDataHolder, IGenericDataHolder
Inheritance
RootElement
Implements
Inherited Members

Fields

Element

The element that this root element represents. This is the only element in its family tree that does not have a Parent.

public readonly Element Element

Field Value

Element

Name

The name of this root element

public readonly string Name

Field Value

string

System

The UiSystem that this root element is a part of.

public readonly UiSystem System

Field Value

UiSystem

Transform

The transformation that this root element (and all of its children) has. This transform is applied both to input, as well as to rendering.

public Matrix Transform

Field Value

Matrix

Properties

ActualScale

The actual scale of this root element. This is a combination of this root element's Scale as well as the ui system's GlobalScale.

public float ActualScale { get; }

Property Value

float

CanBeActive

Determines whether this root element can become the ActiveRoot. This property returns true if CanSelectContent is true and the Element is not hidden, or if it has been set to true manually.

public bool CanBeActive { get; set; }

Property Value

bool

CanSelectContent

Determines whether this root element contains any children that CanBeSelected. This value is automatically calculated, and used in CanBeActive.

public bool CanSelectContent { get; }

Property Value

bool

InvTransform

An inversion of Transform

public Matrix InvTransform { get; }

Property Value

Matrix

Priority

The priority of this root element. A higher priority means the element will be updated first, as well as rendered on top.

public int Priority { get; set; }

Property Value

int

Scale

The scale of this root element. Note that, to change the scale of every root element, you can use GlobalScale

public float Scale { get; set; }

Property Value

float

SelectedElement

The child element of this root element that is currently selected. If there is no selected element in this root, this value will be null.

public Element SelectedElement { get; }

Property Value

Element

Methods

ScaleOrigin(float, Vector2?)

Scales this root element's Transform matrix based on the given scale and origin.

public void ScaleOrigin(float scale, Vector2? origin = null)

Parameters

scale float

The scale to use

origin Vector2?

The origin to use for scaling, or null to use this root's element's center point

SelectElement(Element, bool?, NavigationType?)

Selects the given element that is a child of this root element. Optionally, automatic navigation can be forced on, causing the SelectionIndicator to be drawn around the element.

public void SelectElement(Element element, bool? autoNav = null, UiControls.NavigationType? navType = null)

Parameters

element Element

The element to select, or null to deselect the selected element.

autoNav bool?

Whether automatic navigation should be forced on. If this is null, the automatic navigation state will stay the same.

navType UiControls.NavigationType?

An optional UiControls.NavigationType to set. If this is null, the navigation type will stay the same.

Events

OnAddedToUi

Event that is invoked when this RootElement gets added to a UiSystem in Add(string, Element)

public event Action<UiSystem> OnAddedToUi

Event Type

Action<UiSystem>

OnElementAdded

Event that is invoked when a Element is added to this root element or any of its children.

public event Element.GenericCallback OnElementAdded

Event Type

Element.GenericCallback

OnElementRemoved

Event that is invoked when a Element is removed rom this root element or any of its children.

public event Element.GenericCallback OnElementRemoved

Event Type

Element.GenericCallback

OnRemovedFromUi

Event that is invoked when this RootElement gets removed from a UiSystem in Remove(string)

public event Action<UiSystem> OnRemovedFromUi

Event Type

Action<UiSystem>