Merge branch '1.2' into ui-achorpopup-shiftctrl-modes

This commit is contained in:
Nejcraft
2021-04-07 11:20:20 +02:00
committed by GitHub
2 changed files with 46 additions and 21 deletions

View File

@@ -26,11 +26,30 @@ namespace FlaxEngine.GUI
set => Bounds = new Rectangle(X, value, _bounds.Size);
}
/// <summary>
/// Gets or sets the local X coordinate of the pivot of the control relative to the anchor in parent of its container.
/// </summary>
[HideInEditor, NoSerialize]
public float LocalX
{
get => LocalLocation.X;
set => LocalLocation = new Vector2(value, LocalLocation.Y);
}
/// <summary>
/// Gets or sets the local Y coordinate of the pivot of the control relative to the anchor in parent of its container.
/// </summary>
[HideInEditor, NoSerialize]
public float LocalY
{
get => LocalLocation.Y;
set => LocalLocation = new Vector2(LocalLocation.X, value);
}
/// <summary>
/// Gets or sets the normalized position in the parent control that the upper left corner is anchored to (range 0-1).
/// </summary>
[Serialize]
[HideInEditor, ExpandGroups, Limit(0.0f, 1.0f, 0.01f), EditorDisplay("Transform"), EditorOrder(990), Tooltip("The normalized position in the parent control that the upper left corner is anchored to (range 0-1).")]
[Serialize, HideInEditor]
public Vector2 AnchorMin
{
get => _anchorMin;
@@ -49,8 +68,7 @@ namespace FlaxEngine.GUI
/// <summary>
/// Gets or sets the normalized position in the parent control that the bottom right corner is anchored to (range 0-1).
/// </summary>
[Serialize]
[HideInEditor, ExpandGroups, Limit(0.0f, 1.0f, 0.01f), EditorDisplay("Transform"), EditorOrder(991), Tooltip("The normalized position in the parent control that the bottom right corner is anchored to (range 0-1).")]
[Serialize, HideInEditor]
public Vector2 AnchorMax
{
get => _anchorMax;
@@ -69,8 +87,7 @@ namespace FlaxEngine.GUI
/// <summary>
/// Gets or sets the offsets of the corners of the control relative to its anchors.
/// </summary>
[Serialize]
[HideInEditor, ExpandGroups, EditorDisplay("Transform"), EditorOrder(992), Tooltip("The offsets of the corners of the control relative to its anchors.")]
[Serialize, HideInEditor]
public Margin Offsets
{
get => _offsets;
@@ -91,8 +108,8 @@ namespace FlaxEngine.GUI
[NoSerialize, HideInEditor]
internal float Proxy_Offset_Left
{
get => Offsets.Left;
set => Offsets = new Margin(value, Offsets.Right, Offsets.Top, Offsets.Bottom);
get => _offsets.Left;
set => Offsets = new Margin(value, _offsets.Right, _offsets.Top, _offsets.Bottom);
}
/// <summary>
@@ -101,8 +118,8 @@ namespace FlaxEngine.GUI
[NoSerialize, HideInEditor]
internal float Proxy_Offset_Right
{
get => Offsets.Right;
set => Offsets = new Margin(Offsets.Left, value, Offsets.Top, Offsets.Bottom);
get => _offsets.Right;
set => Offsets = new Margin(_offsets.Left, value, _offsets.Top, _offsets.Bottom);
}
/// <summary>
@@ -111,8 +128,8 @@ namespace FlaxEngine.GUI
[NoSerialize, HideInEditor]
internal float Proxy_Offset_Top
{
get => Offsets.Top;
set => Offsets = new Margin(Offsets.Left, Offsets.Right, value, Offsets.Bottom);
get => _offsets.Top;
set => Offsets = new Margin(_offsets.Left, _offsets.Right, value, _offsets.Bottom);
}
/// <summary>
@@ -121,22 +138,31 @@ namespace FlaxEngine.GUI
[NoSerialize, HideInEditor]
internal float Proxy_Offset_Bottom
{
get => Offsets.Bottom;
set => Offsets = new Margin(Offsets.Left, Offsets.Right, Offsets.Top, value);
get => _offsets.Bottom;
set => Offsets = new Margin(_offsets.Left, _offsets.Right, _offsets.Top, value);
}
#endif
/// <summary>
/// Gets or sets coordinates of the upper-left corner of the control relative to the upper-left corner of its container.
/// </summary>
[NoSerialize]
[HideInEditor, ExpandGroups, EditorDisplay("Transform"), EditorOrder(1000), Tooltip("The location of the upper-left corner of the control relative to he upper-left corner of its container.")]
[NoSerialize, HideInEditor]
public Vector2 Location
{
get => _bounds.Location;
set => Bounds = new Rectangle(value, _bounds.Size);
}
/// <summary>
/// Gets or sets the local position of the pivot of the control relative to the anchor in parent of its container.
/// </summary>
[NoSerialize, HideInEditor]
public Vector2 LocalLocation
{
get => _bounds.Location - (_parent != null ? _parent._bounds.Size * (_anchorMax + _anchorMin) * 0.5f : Vector2.Zero) + _bounds.Size * _pivot;
set => Bounds = new Rectangle(value + (_parent != null ? _parent.Bounds.Size * (_anchorMax + _anchorMin) * 0.5f : Vector2.Zero) - _bounds.Size * _pivot, _bounds.Size);
}
/// <summary>
/// Gets or sets width of the control.
/// </summary>
@@ -160,8 +186,7 @@ namespace FlaxEngine.GUI
/// <summary>
/// Gets or sets control's size.
/// </summary>
[NoSerialize]
[HideInEditor, EditorDisplay("Transform"), EditorOrder(1010), Tooltip("The size of the control bounds.")]
[NoSerialize, HideInEditor]
public Vector2 Size
{
get => _bounds.Size;