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

Ensure that Element.IsMouseOver is always accurate by making it an auto-property

This commit is contained in:
Ell 2022-04-15 14:18:55 +02:00
parent 783da33107
commit c78bafd000
2 changed files with 4 additions and 6 deletions

View file

@ -17,6 +17,9 @@ Additions
Additions
- Added Element.AutoNavGroup which allows forming groups for auto-navigation
Improvements
- Ensure that Element.IsMouseOver is always accurate by making it an auto-property
Fixes
- Fixed auto-nav tooltip displaying on the selected element even when not in auto-nav mode
- Fixed radio buttons not unchecking all other radio buttons with the same root element

View file

@ -240,7 +240,7 @@ namespace MLEM.Ui.Elements {
/// <summary>
/// Stores whether this element is currently being moused over or touched.
/// </summary>
public bool IsMouseOver { get; protected set; }
public bool IsMouseOver => this.Controls.MousedElement == this || this.Controls.TouchedElement == this;
/// <summary>
/// Returns whether this element is its <see cref="Root"/>'s <see cref="RootElement.SelectedElement"/>.
/// </summary>
@ -439,11 +439,6 @@ namespace MLEM.Ui.Elements {
this.size = size;
this.Children = new ReadOnlyCollection<Element>(this.children);
this.OnMouseEnter += element => this.IsMouseOver = true;
this.OnMouseExit += element => this.IsMouseOver = false;
this.OnTouchEnter += element => this.IsMouseOver = true;
this.OnTouchExit += element => this.IsMouseOver = false;
this.GetTabNextElement += (backward, next) => next;
this.GetGamepadNextElement += (dir, next) => next;