1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-10 03:28:43 +02:00

Removed AutoHideCondition (partially reverts d5d3297)

This commit is contained in:
Ell 2022-12-21 21:02:10 +01:00
parent d5d3297271
commit 45c668c992
2 changed files with 2 additions and 12 deletions

View file

@ -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

View file

@ -172,15 +172,9 @@ namespace MLEM.Ui.Elements {
/// <summary>
/// Set this property to <c>true</c> 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 <see cref="AutoHideCondition"/> to set it automatically.
/// </summary>
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 {
/// </summary>
[Obsolete("OnDisposed will be removed in a future update. To unregister custom event handlers, use OnRemovedFromUi instead.")]
public GenericCallback OnDisposed;
/// <summary>
/// An optional function that can be used to set <see cref="IsHidden"/> automatically based on a user-defined condition. This removes the need to hide an element based on a condition in <see cref="Element.OnUpdated"/> or manually.
/// </summary>
public Func<Element, bool> AutoHideCondition;
/// <summary>
/// A list of all of this element's direct children.