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

Fixed Element.IsSelected returning incorrect results when CanBeSelected changes

This commit is contained in:
Ell 2022-03-17 20:45:28 +01:00
parent 4aff5a2875
commit 1f4f0cfa44
2 changed files with 3 additions and 5 deletions

View file

@ -61,7 +61,7 @@ Fixes
- Fixed UiControls allowing for non-selectable or non-mouseable elements to be marked as selected or moused
- Fixed buttons and checkboxes changing their CanBeSelected and CanBePressed values when being disabled
- Fixed children of Panel scroll bars also being scrolled
- Fixed RootElement.CanSelectContent returning incorrect results when CanBeSelected changes in children
- Fixed RootElement.CanSelectContent and Element.IsSelected returning incorrect results when CanBeSelected changes
Removals
- Marked StyleProp equality members as obsolete

View file

@ -241,9 +241,9 @@ namespace MLEM.Ui.Elements {
/// </summary>
public bool IsMouseOver { get; protected set; }
/// <summary>
/// Stores 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>
public bool IsSelected { get; protected set; }
public bool IsSelected => this.Root.SelectedElement == this;
/// <summary>
/// Returns whether this element's <see cref="SetAreaDirty"/> method has been recently called and its area has not been updated since then using <see cref="UpdateAreaIfDirty"/> or <see cref="ForceUpdateArea"/>.
/// </summary>
@ -436,8 +436,6 @@ namespace MLEM.Ui.Elements {
this.OnMouseExit += element => this.IsMouseOver = false;
this.OnTouchEnter += element => this.IsMouseOver = true;
this.OnTouchExit += element => this.IsMouseOver = false;
this.OnSelected += element => this.IsSelected = true;
this.OnDeselected += element => this.IsSelected = false;
this.GetTabNextElement += (backward, next) => next;
this.GetGamepadNextElement += (dir, next) => next;