// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. namespace FlaxEngine.GUI { /// /// Changes alpha of all its children /// public class AlphaPanel : ContainerControl { /// /// The target alpha value. /// [EditorOrder(0), Limit(0, 1, 0.01f), Tooltip("The target alpha value.")] public float Alpha = 1.0f; /// /// Whether or not we should ignore previous alphas. /// [EditorOrder(10), Tooltip("Whether or not we should ignore previous alphas.")] public bool IgnoreStack; /// /// Initializes a new instance of the class. /// public AlphaPanel() { AutoFocus = false; } /// public override void Draw() { Render2D.PeekTint(out Color oldColor); if (IgnoreStack) { Color newColor = new Color(oldColor.R, oldColor.G, oldColor.B, Alpha); Render2D.PushTint(ref newColor, false); } else { Color newColor = new Color(oldColor.R, oldColor.G, oldColor.B, oldColor.A * Alpha); Render2D.PushTint(ref newColor, false); } base.Draw(); Render2D.PopTint(); } } }