Merge branch 'ui-localPosition' of git://github.com/honzapatCZ/FlaxEngine into honzapatCZ-ui-localPosition
This commit is contained in:
@@ -423,9 +423,9 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
|
||||
private void BuildLocationSizeOffsets(LayoutElementsContainer horUp, LayoutElementsContainer horDown, bool xEq, bool yEq, ScriptType[] valueTypes)
|
||||
{
|
||||
ScriptMemberInfo xInfo = valueTypes[0].GetProperty("X");
|
||||
ScriptMemberInfo xInfo = valueTypes[0].GetProperty("LocalX");
|
||||
ItemInfo xItem = new ItemInfo(xInfo);
|
||||
ScriptMemberInfo yInfo = valueTypes[0].GetProperty("Y");
|
||||
ScriptMemberInfo yInfo = valueTypes[0].GetProperty("LocalY");
|
||||
ItemInfo yItem = new ItemInfo(yInfo);
|
||||
ScriptMemberInfo widthInfo = valueTypes[0].GetProperty("Width");
|
||||
ItemInfo widthItem = new ItemInfo(widthInfo);
|
||||
|
||||
@@ -26,6 +26,26 @@ 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>
|
||||
@@ -137,6 +157,17 @@ namespace FlaxEngine.GUI
|
||||
set => Bounds = new Rectangle(value, _bounds.Size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The local position of the pivot of the control relative to the anchor in parent of its container.
|
||||
/// </summary>
|
||||
[NoSerialize]
|
||||
[HideInEditor, ExpandGroups, EditorDisplay("Transform"), EditorOrder(1000), Tooltip("The local position of the pivot of the control relative to the anchor in parent of its container.")]
|
||||
public Vector2 LocalLocation
|
||||
{
|
||||
get => _bounds.Location - (Parent.Size * (AnchorMax + AnchorMin) / 2) + Size * Pivot;
|
||||
set => Bounds = new Rectangle(value + (Parent.Size * (AnchorMax + AnchorMin) / 2) - Size * Pivot, _bounds.Size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets width of the control.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user