1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-25 14:08:34 +01:00

Compare commits

..

No commits in common. "c78bafd0005272c9db9a0c7fa8de9861871102be" and "be26a2ebc20360092b66e6c8b30f588a99b1781b" have entirely different histories.

2 changed files with 6 additions and 7 deletions

View file

@ -17,13 +17,9 @@ Additions
Additions Additions
- Added Element.AutoNavGroup which allows forming groups for auto-navigation - 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 Fixes
- Fixed auto-nav tooltip displaying on the selected element even when not in auto-nav mode - 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 - Fixed radio buttons not unchecking all other radio buttons with the same root element
- Fixed elements not being deselected when removed through RemoveChild
## 5.3.0 ## 5.3.0
### MLEM ### MLEM

View file

@ -240,7 +240,7 @@ namespace MLEM.Ui.Elements {
/// <summary> /// <summary>
/// Stores whether this element is currently being moused over or touched. /// Stores whether this element is currently being moused over or touched.
/// </summary> /// </summary>
public bool IsMouseOver => this.Controls.MousedElement == this || this.Controls.TouchedElement == this; public bool IsMouseOver { get; protected set; }
/// <summary> /// <summary>
/// Returns whether this element is its <see cref="Root"/>'s <see cref="RootElement.SelectedElement"/>. /// Returns whether this element is its <see cref="Root"/>'s <see cref="RootElement.SelectedElement"/>.
/// </summary> /// </summary>
@ -439,6 +439,11 @@ namespace MLEM.Ui.Elements {
this.size = size; this.size = size;
this.Children = new ReadOnlyCollection<Element>(this.children); 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.GetTabNextElement += (backward, next) => next;
this.GetGamepadNextElement += (dir, next) => next; this.GetGamepadNextElement += (dir, next) => next;
@ -480,8 +485,6 @@ namespace MLEM.Ui.Elements {
/// <param name="element">The child element to remove</param> /// <param name="element">The child element to remove</param>
public virtual void RemoveChild(Element element) { public virtual void RemoveChild(Element element) {
this.children.Remove(element); this.children.Remove(element);
if (this.Root?.SelectedElement == element)
this.Root.SelectElement(null);
// set area dirty here so that a dirty call is made // set area dirty here so that a dirty call is made
// upwards to us if the element is auto-positioned // upwards to us if the element is auto-positioned
element.SetAreaDirty(); element.SetAreaDirty();