Class VisualElementFocusRing
Implementation of a linear focus ring. Elements are sorted according to their focusIndex.
Namespace: UnityEngine.UIElements
Syntax
public class VisualElementFocusRing : object, IFocusRing
Constructors
VisualElementFocusRing(VisualElement, VisualElementFocusRing.DefaultFocusOrder)
Constructor.
Declaration
public VisualElementFocusRing(VisualElement root, VisualElementFocusRing.DefaultFocusOrder dfo = VisualElementFocusRing.DefaultFocusOrder.ChildOrder)
Parameters
Type | Name | Description |
---|---|---|
VisualElement | root | The root of the element tree for which we want to build a focus ring. |
VisualElementFocusRing.DefaultFocusOrder | dfo | Default ordering of the elements in the ring. |
Properties
defaultFocusOrder
The focus order for elements having 0 has a focusIndex.
Declaration
public VisualElementFocusRing.DefaultFocusOrder defaultFocusOrder { get; set; }
Property Value
Type | Description |
---|---|
VisualElementFocusRing.DefaultFocusOrder |
Methods
GetFocusChangeDirection(Focusable, EventBase)
Get the direction of the focus change for the given event. For example, when the Tab key is pressed, focus should be given to the element to the right in the focus ring.
Declaration
public FocusChangeDirection GetFocusChangeDirection(Focusable currentFocusable, EventBase e)
Parameters
Type | Name | Description |
---|---|---|
Focusable | currentFocusable | |
EventBase | e |
Returns
Type | Description |
---|---|
FocusChangeDirection |
Implements
GetNextFocusable(Focusable, FocusChangeDirection)
Get the next element in the given direction.
Declaration
public Focusable GetNextFocusable(Focusable currentFocusable, FocusChangeDirection direction)
Parameters
Type | Name | Description |
---|---|---|
Focusable | currentFocusable | |
FocusChangeDirection | direction |
Returns
Type | Description |
---|---|
Focusable |