Fix Vertical/Horizontal panels issue with anchored child controls

#378
This commit is contained in:
Wojtek Figat
2021-03-23 09:24:56 +01:00
parent fad1e6fdfc
commit e8c9856665
3 changed files with 8 additions and 3 deletions

View File

@@ -47,7 +47,12 @@ namespace FlaxEngine.GUI
public float Bottom;
/// <summary>
/// Gets the margin's total size. Cumulative margin size.
/// Gets the margin's location (Left, Top).
/// </summary>
public Vector2 Location => new Vector2(Left, Top);
/// <summary>
/// Gets the margin's total size. Cumulative margin size (Left + Right, Top + Bottom).
/// </summary>
public Vector2 Size => new Vector2(Left + Right, Top + Bottom);

View File

@@ -25,7 +25,7 @@ namespace FlaxEngine.GUI
for (int i = 0; i < _children.Count; i++)
{
Control c = _children[i];
if (c.Visible)
if (c.Visible && Mathf.IsZero(c.AnchorMin.Y) && Mathf.IsZero(c.AnchorMax.Y))
{
c.Height = h;
}

View File

@@ -25,7 +25,7 @@ namespace FlaxEngine.GUI
for (int i = 0; i < _children.Count; i++)
{
Control c = _children[i];
if (c.Visible)
if (c.Visible && Mathf.IsZero(c.AnchorMin.X) && Mathf.IsZero(c.AnchorMax.X))
{
c.Width = w;
}