1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

Fixed tooltips sometimes ignoring manually set IsHidden values

This commit is contained in:
Ell 2022-04-05 14:17:12 +02:00
parent 37f0470e4f
commit df0ad68837
3 changed files with 6 additions and 4 deletions

View file

@ -70,6 +70,7 @@ Fixes
- Fixed RootElement.CanSelectContent and Element.IsSelected returning incorrect results when CanBeSelected changes - Fixed RootElement.CanSelectContent and Element.IsSelected returning incorrect results when CanBeSelected changes
- Fixed dropdowns with some non-selectable children failing to navigate when using gamepad controls - Fixed dropdowns with some non-selectable children failing to navigate when using gamepad controls
- Fixed UiMetrics.ForceAreaUpdateTime being inaccurate for nested elements - Fixed UiMetrics.ForceAreaUpdateTime being inaccurate for nested elements
- Fixed tooltips sometimes ignoring manually set IsHidden values
Removals Removals
- Marked StyleProp equality members as obsolete - Marked StyleProp equality members as obsolete

View file

@ -151,7 +151,7 @@ namespace MLEM.Ui.Elements {
/// 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.
/// </summary> /// </summary>
public bool IsHidden { public virtual bool IsHidden {
get => this.isHidden; get => this.isHidden;
set { set {
if (this.isHidden == value) if (this.isHidden == value)

View file

@ -30,6 +30,9 @@ namespace MLEM.Ui.Elements {
/// </summary> /// </summary>
public virtual Vector2? SnapPosition { get; set; } public virtual Vector2? SnapPosition { get; set; }
/// <inheritdoc />
public override bool IsHidden => this.autoHidden || base.IsHidden;
private TimeSpan delayCountdown; private TimeSpan delayCountdown;
private bool autoHidden; private bool autoHidden;
@ -167,10 +170,8 @@ namespace MLEM.Ui.Elements {
} }
} }
if (this.autoHidden != shouldBeHidden) { if (this.autoHidden != shouldBeHidden) {
// only auto-hide if IsHidden wasn't changed manually
if (this.IsHidden == this.autoHidden)
this.IsHidden = shouldBeHidden;
this.autoHidden = shouldBeHidden; this.autoHidden = shouldBeHidden;
this.SetAreaDirty();
} }
} }