Struct ScyllaUIEdgeInsets
A per-edge inset value used for both stack padding and screen margins. Each edge is a ScyllaUILength so individual edges may be expressed as absolute pixels or as a percent of the relevant parent dimension.
Implements
Inherited Members
Namespace: Scylla.Core.Util.UI
Assembly: ScyllaCore.dll
Syntax
[Serializable]
public struct ScyllaUIEdgeInsets : IEquatable<ScyllaUIEdgeInsets>
Remarks
For stack padding, top and bottom percent values resolve against the stack's own resolved height, and left and right resolve against its own resolved width. For screen margins, top and bottom resolve against the canvas height, and left and right resolve against the canvas width.
Use the static factory methods All(ScyllaUILength) for a uniform inset and Symmetric(ScyllaUILength, ScyllaUILength) for separate horizontal and vertical values.
Constructors
ScyllaUIEdgeInsets(ScyllaUILength, ScyllaUILength, ScyllaUILength, ScyllaUILength)
Initializes a new ScyllaUIEdgeInsets with the supplied per-edge lengths.
Declaration
public ScyllaUIEdgeInsets(ScyllaUILength top, ScyllaUILength right, ScyllaUILength bottom, ScyllaUILength left)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaUILength | top | Inset on the top edge. |
| ScyllaUILength | right | Inset on the right edge. |
| ScyllaUILength | bottom | Inset on the bottom edge. |
| ScyllaUILength | left | Inset on the left edge. |
Fields
Zero
A zero inset on all four edges.
Declaration
public static readonly ScyllaUIEdgeInsets Zero
Field Value
| Type | Description |
|---|---|
| ScyllaUIEdgeInsets |
Properties
Bottom
The bottom-edge inset.
Declaration
public ScyllaUILength Bottom { get; }
Property Value
| Type | Description |
|---|---|
| ScyllaUILength |
Left
The left-edge inset.
Declaration
public ScyllaUILength Left { get; }
Property Value
| Type | Description |
|---|---|
| ScyllaUILength |
Right
The right-edge inset.
Declaration
public ScyllaUILength Right { get; }
Property Value
| Type | Description |
|---|---|
| ScyllaUILength |
Top
The top-edge inset.
Declaration
public ScyllaUILength Top { get; }
Property Value
| Type | Description |
|---|---|
| ScyllaUILength |
Methods
All(ScyllaUILength)
Creates a uniform ScyllaUIEdgeInsets with the same value on all four edges.
Declaration
public static ScyllaUIEdgeInsets All(ScyllaUILength value)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaUILength | value | The length used on all four edges. |
Returns
| Type | Description |
|---|---|
| ScyllaUIEdgeInsets | A new ScyllaUIEdgeInsets with |
Equals(ScyllaUIEdgeInsets)
Determines whether all four edges of this inset are approximately equal to the
corresponding edges of other, using
Equals(ScyllaUILength) per edge.
Declaration
public bool Equals(ScyllaUIEdgeInsets other)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaUIEdgeInsets | other | The inset to compare against. |
Returns
| Type | Description |
|---|---|
| bool |
|
Equals(object)
Returns true when obj is a ScyllaUIEdgeInsets
and all four edges are approximately equal to this inset.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare against. |
Returns
| Type | Description |
|---|---|
| bool |
|
Overrides
GetHashCode()
Returns a hash code derived from all four edge values of this inset.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
ResolveHorizontal(float)
Resolves the horizontal inset (left + right) against
parentWidth.
Declaration
public float ResolveHorizontal(float parentWidth)
Parameters
| Type | Name | Description |
|---|---|---|
| float | parentWidth | The parent width used to resolve percent values on the left and right edges. |
Returns
| Type | Description |
|---|---|
| float | The combined horizontal inset, in reference-resolution pixels. |
ResolveVertical(float)
Resolves the vertical inset (top + bottom) against
parentHeight.
Declaration
public float ResolveVertical(float parentHeight)
Parameters
| Type | Name | Description |
|---|---|---|
| float | parentHeight | The parent height used to resolve percent values on the top and bottom edges. |
Returns
| Type | Description |
|---|---|
| float | The combined vertical inset, in reference-resolution pixels. |
Symmetric(ScyllaUILength, ScyllaUILength)
Creates a symmetric ScyllaUIEdgeInsets, with one length for the left and right edges and another for the top and bottom edges.
Declaration
public static ScyllaUIEdgeInsets Symmetric(ScyllaUILength horizontal, ScyllaUILength vertical)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaUILength | horizontal | Inset applied to the left and right edges. |
| ScyllaUILength | vertical | Inset applied to the top and bottom edges. |
Returns
| Type | Description |
|---|---|
| ScyllaUIEdgeInsets | A new ScyllaUIEdgeInsets with the given horizontal and vertical values. |
Operators
operator ==(ScyllaUIEdgeInsets, ScyllaUIEdgeInsets)
Returns true when all four edges of left are
approximately equal to the corresponding edges of right,
as determined by Equals(ScyllaUIEdgeInsets).
Declaration
public static bool operator ==(ScyllaUIEdgeInsets left, ScyllaUIEdgeInsets right)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaUIEdgeInsets | left | The left-hand operand. |
| ScyllaUIEdgeInsets | right | The right-hand operand. |
Returns
| Type | Description |
|---|---|
| bool |
|
operator !=(ScyllaUIEdgeInsets, ScyllaUIEdgeInsets)
Returns true when left and right
differ on at least one edge, as determined by the negation of
operator ==(ScyllaUIEdgeInsets, ScyllaUIEdgeInsets).
Declaration
public static bool operator !=(ScyllaUIEdgeInsets left, ScyllaUIEdgeInsets right)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaUIEdgeInsets | left | The left-hand operand. |
| ScyllaUIEdgeInsets | right | The right-hand operand. |
Returns
| Type | Description |
|---|---|
| bool |
|