1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 20:58:34 +01: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 ScrollBar.MouseDragScrolling
- Added Panel.ScrollToElement - Added Panel.ScrollToElement
- Added ElementHelper.MakeGrid - Added ElementHelper.MakeGrid
- Added Element.AutoHideCondition and Button.AutoDisableCondition - Added Button.AutoDisableCondition
Improvements Improvements
- Allow elements to auto-adjust their size even when their children are aligned oddly - 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> /// <summary>
/// Set this property to <c>true</c> to cause this element to be hidden. /// 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. /// 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> /// </summary>
public virtual bool IsHidden { public virtual bool IsHidden {
get { get => this.isHidden;
// 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;
}
set { set {
if (this.isHidden == value) if (this.isHidden == value)
return; return;
@ -436,10 +430,6 @@ namespace MLEM.Ui.Elements {
/// </summary> /// </summary>
[Obsolete("OnDisposed will be removed in a future update. To unregister custom event handlers, use OnRemovedFromUi instead.")] [Obsolete("OnDisposed will be removed in a future update. To unregister custom event handlers, use OnRemovedFromUi instead.")]
public GenericCallback OnDisposed; 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> /// <summary>
/// A list of all of this element's direct children. /// A list of all of this element's direct children.