diff --git a/MLEM.Ui/Elements/Element.cs b/MLEM.Ui/Elements/Element.cs index 697d490..af3995e 100644 --- a/MLEM.Ui/Elements/Element.cs +++ b/MLEM.Ui/Elements/Element.cs @@ -471,6 +471,8 @@ namespace MLEM.Ui.Elements { public virtual void Draw(GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix) { this.System.OnElementDrawn?.Invoke(this, time, batch, alpha); + if (this.Root.SelectedElement == this) + this.System.OnSelectedElementDrawn?.Invoke(this, time, batch, alpha); foreach (var child in this.GetRelevantChildren()) { if (!child.IsHidden) diff --git a/MLEM.Ui/UiSystem.cs b/MLEM.Ui/UiSystem.cs index 6883e0b..e0206f0 100644 --- a/MLEM.Ui/UiSystem.cs +++ b/MLEM.Ui/UiSystem.cs @@ -121,8 +121,6 @@ namespace MLEM.Ui { batch.Begin(SpriteSortMode.Deferred, this.BlendState, this.SamplerState, null, null, null, root.Transform); var alpha = this.DrawAlpha * root.Element.DrawAlpha; root.Element.Draw(time, batch, alpha, this.BlendState, this.SamplerState, root.Transform); - if (root.SelectedElement != null) - this.OnSelectedElementDrawn?.Invoke(root.SelectedElement, time, batch, alpha); batch.End(); } }