Revert children clipping to be called outside DrawChildren (regression from #355)

This commit is contained in:
Wojtek Figat
2021-03-18 14:26:00 +01:00
parent 922201d1c0
commit 960a122550

View File

@@ -622,7 +622,18 @@ namespace FlaxEngine.GUI
public override void Draw()
{
DrawSelf();
DrawChildren();
if (ClipChildren)
{
GetDesireClientArea(out var clientArea);
Render2D.PushClip(ref clientArea);
DrawChildren();
Render2D.PopClip();
}
else
{
DrawChildren();
}
}
/// <summary>
@@ -630,21 +641,14 @@ namespace FlaxEngine.GUI
/// </summary>
public virtual void DrawSelf()
{
base.Draw();
base.Draw();
}
/// <summary>
/// Draws the children. Can be overridden to provide some customizations. Draw is performed with applied clipping mask for the client area.
/// </summary>
protected virtual void DrawChildren()
{
// Push clipping mask
if (ClipChildren)
{
GetDesireClientArea(out var clientArea);
Render2D.PushClip(ref clientArea);
}
// Draw all visible child controls
if (CullChildren)
{
@@ -679,12 +683,6 @@ namespace FlaxEngine.GUI
}
}
}
// Pop clipping mask
if (ClipChildren)
{
Render2D.PopClip();
}
}
/// <inheritdoc />