Class FloatingPosition
Definition
Namespace: StardewUI.Layout
Assembly: StardewUI.dll
Describes the position of a FloatingElement.
Inheritance
Object ⇦ FloatingPosition
Members
Constructors
Name | Description |
---|---|
FloatingPosition(Func<Vector2, Vector2, Vector2>) | Describes the position of a FloatingElement. |
Fields
Name | Description |
---|---|
AboveParent | Positions the floating element immediately above the parent view, so that its bottom edge is flush with the parent's top edge. |
AfterParent | Positions the floating element immediately to the right of (after) the parent view, so that its left edge is flush with the parent's right edge. |
BeforeParent | Positions the floating element immediately to the left of (before) the parent view, so that its right edge is flush with the parent's left edge. |
BelowParent | Positions the floating element immediately below the parent view, so that its top edge is flush with the parent's bottom edge. |
Methods
Name | Description |
---|---|
GetOffset(IView, IView) | Calculates the final position of the floating view. |
GetOffset(Vector2, Vector2) | Calculates the relative origin position of a floating view based on its size and the size of its parent. |
Parse(string) | Parses a FloatingPosition from its string representation. |
TryParse(string, FloatingPosition) | Attempts to parse a FloatingPosition from its string representation. |
Details
Constructors
FloatingPosition(Func<Vector2, Vector2, Vector2>)
Describes the position of a FloatingElement.
public FloatingPosition(Func<Microsoft.Xna.Framework.Vector2, Microsoft.Xna.Framework.Vector2, Microsoft.Xna.Framework.Vector2> offsetSelector);
Parameters
offsetSelector
Func<Vector2, Vector2, Vector2>
Calculates the position offset (relative to the parent) of the floating view. Takes the measured floating view size, and then the parent size, as arguments.
Fields
AboveParent
Positions the floating element immediately above the parent view, so that its bottom edge is flush with the parent's top edge.
Field Value
AfterParent
Positions the floating element immediately to the right of (after) the parent view, so that its left edge is flush with the parent's right edge.
Field Value
BeforeParent
Positions the floating element immediately to the left of (before) the parent view, so that its right edge is flush with the parent's left edge.
Field Value
BelowParent
Positions the floating element immediately below the parent view, so that its top edge is flush with the parent's bottom edge.
Field Value
Methods
GetOffset(IView, IView)
Calculates the final position of the floating view.
Parameters
view
IView
The floating view to position.
parentView
IView
The parent relative to which the floating view is being positioned.
Returns
The final position where the view
should be drawn.
GetOffset(Vector2, Vector2)
Calculates the relative origin position of a floating view based on its size and the size of its parent.
public Microsoft.Xna.Framework.Vector2 GetOffset(Microsoft.Xna.Framework.Vector2 viewSize, Microsoft.Xna.Framework.Vector2 parentViewSize);
Parameters
viewSize
Vector2
The size of the floating view.
parentViewSize
Vector2
The size of the parent against which the floating element is positioned.
Returns
The final position where the floating element should be drawn.
Parse(string)
Parses a FloatingPosition from its string representation.
Parameters
text
string
The string value to parse.
Returns
The parsed position.
TryParse(string, FloatingPosition)
Attempts to parse a FloatingPosition from its string representation.
Parameters
text
string
The string value to parse.
result
FloatingPosition
If the method returns true
, holds the parsed position; otherwise null
.
Returns
true
if the text
was successfully parsed into a position; false
if the input was not in a valid format.