From 45c668c992d62a7b82b557d91aba4847873240ff Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 21 Dec 2022 21:02:10 +0100 Subject: [PATCH] Removed AutoHideCondition (partially reverts d5d3297) --- CHANGELOG.md | 2 +- MLEM.Ui/Elements/Element.cs | 12 +----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f00791..a1b9b5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,7 +57,7 @@ Additions - Added ScrollBar.MouseDragScrolling - Added Panel.ScrollToElement - Added ElementHelper.MakeGrid -- Added Element.AutoHideCondition and Button.AutoDisableCondition +- Added Button.AutoDisableCondition Improvements - Allow elements to auto-adjust their size even when their children are aligned oddly diff --git a/MLEM.Ui/Elements/Element.cs b/MLEM.Ui/Elements/Element.cs index c460ddd..22a6550 100644 --- a/MLEM.Ui/Elements/Element.cs +++ b/MLEM.Ui/Elements/Element.cs @@ -172,15 +172,9 @@ namespace MLEM.Ui.Elements { /// /// Set this property to true to cause this element to be hidden. /// Hidden elements don't receive input events, aren't rendered and don't factor into auto-anchoring. - /// If this value changes often, consider using to set it automatically. /// public virtual bool IsHidden { - get { - // instead of just returning, we set IsHidden here because we might have to set our area dirty - if (this.AutoHideCondition != null) - this.IsHidden = this.AutoHideCondition(this); - return this.isHidden; - } + get => this.isHidden; set { if (this.isHidden == value) return; @@ -436,10 +430,6 @@ namespace MLEM.Ui.Elements { /// [Obsolete("OnDisposed will be removed in a future update. To unregister custom event handlers, use OnRemovedFromUi instead.")] public GenericCallback OnDisposed; - /// - /// An optional function that can be used to set automatically based on a user-defined condition. This removes the need to hide an element based on a condition in or manually. - /// - public Func AutoHideCondition; /// /// A list of all of this element's direct children.