1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-25 05:58:35 +01:00

Compare commits

...

2 commits

2 changed files with 7 additions and 6 deletions

View file

@ -17,9 +17,13 @@ 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 { get; protected set; } public bool IsMouseOver => this.Controls.MousedElement == this || this.Controls.TouchedElement == this;
/// <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,11 +439,6 @@ 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;
@ -485,6 +480,8 @@ 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();