From e96b155f99dbf7a268c9bec460aded5685e28c2f Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 16 Mar 2020 15:44:53 +0100 Subject: [PATCH] fixed selected element looking bad with smooth scrolling --- MLEM.Ui/Elements/Element.cs | 2 ++ MLEM.Ui/UiSystem.cs | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) 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(); } }