Class FocusSearchResult
Definition
Namespace: StardewUI.Input
Assembly: StardewUI.dll
The result of a FocusSearch(Vector2, Direction). Identifies the specific view/position found, as well as the path to that view from the search root.
Inheritance
Object ⇦ FocusSearchResult
Implements
IEquatable<FocusSearchResult>
Members
Constructors
Name | Description |
---|---|
FocusSearchResult(ViewChild, IReadOnlyList<ViewChild>) | The result of a FocusSearch(Vector2, Direction). Identifies the specific view/position found, as well as the path to that view from the search root. |
Properties
Name | Description |
---|---|
EqualityContract | |
Path | The path from root to Target, in top-down order; each element's Position is relative to the parent, not the search root as Target is. |
Target | The specific view that can/will be focused, with a Position relative to the search root. |
Methods
Name | Description |
---|---|
AbsoluteTarget() | Gets the Target in coordinates relative to the root of the Path. |
AsChild(IView, Vector2) | Returns a transformed FocusSearchResult that adds a view (generally the caller) to the beginning of the Path, and applies its content offset to either the first element of the current Path (if non-empty) or the Target (if the path is empty). |
Offset(Vector2) | Applies a local offset to a search result. |
Details
Constructors
FocusSearchResult(ViewChild, IReadOnlyList<ViewChild>)
The result of a FocusSearch(Vector2, Direction). Identifies the specific view/position found, as well as the path to that view from the search root.
public FocusSearchResult(StardewUI.ViewChild Target, System.Collections.Generic.IReadOnlyList<StardewUI.ViewChild> Path);
Parameters
Target
ViewChild
The specific view that can/will be focused, with a Position relative to the search root.
Path
IReadOnlyList<ViewChild>
The path from root to Target, in top-down order; each element's Position is relative to the parent, not the search root as Target
is.
Properties
EqualityContract
Property Value
Path
The path from root to Target, in top-down order; each element's Position is relative to the parent, not the search root as Target
is.
Property Value
Target
The specific view that can/will be focused, with a Position relative to the search root.
Property Value
Methods
AbsoluteTarget()
Gets the Target in coordinates relative to the root of the Path.
Returns
A new ViewChild pointing to the same View as the Target and having its Position adjusted to the offsets in the Path.
Remarks
These are not necessarily "global" coordinates because the Path may itself be relative.
AsChild(IView, Vector2)
Returns a transformed FocusSearchResult that adds a view (generally the caller) to the beginning of the Path, and applies its content offset to either the first element of the current Path (if non-empty) or the Target (if the path is empty).
public StardewUI.Input.FocusSearchResult AsChild(StardewUI.IView parent, Microsoft.Xna.Framework.Vector2 position);
Parameters
parent
IView
The parent that contains the current result.
position
Vector2
The content offset relative to the parent
.
Returns
Remarks
Used to propagate results correctly up the view hierarchy in a focus search. This is called by FocusSearch(Vector2, Direction) and should not be called in overrides of FindFocusableDescendant(Vector2, Direction).
Offset(Vector2)
Applies a local offset to a search result.
Parameters
distance
Vector2
The distance to offset the Target and first element of Path.
Returns
A new FocusSearchResult with the distance
offset applied.
Remarks
Used to propagate the child position into a search result produced by that child. For example, view A is a layout with positioned child view C, which yields a search result targeting view Z in terms of its (C's) local coordinates. Applying the offset will adjust either the first element of the Path, if non-empty, or the Target itself if Path is empty. No other elements of the Path will be modified, as each element is already positioned relative to its parent preceding it in the list.