mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
fixed an issue where already removed uis would still be selectable
This commit is contained in:
parent
f4658aede0
commit
21dce9d60a
1 changed files with 3 additions and 3 deletions
|
@ -54,7 +54,7 @@ namespace MLEM.Ui {
|
|||
|
||||
// KEYBOARD INPUT
|
||||
else if (this.Input.IsKeyPressed(Keys.Enter) || this.Input.IsKeyPressed(Keys.Space)) {
|
||||
if (this.SelectedElement != null) {
|
||||
if (this.SelectedElement?.Root != null) {
|
||||
if (this.Input.IsModifierKeyDown(ModifierKey.Shift)) {
|
||||
// secondary action on element using space or enter
|
||||
this.SelectedElement.OnSecondaryPressed?.Invoke(this.SelectedElement);
|
||||
|
@ -109,8 +109,8 @@ namespace MLEM.Ui {
|
|||
var currRoot = this.system.GetRootElements().FirstOrDefault(root => root.CanSelectContent);
|
||||
if (currRoot == null)
|
||||
return null;
|
||||
var children = currRoot.Element.GetChildren(regardChildrensChildren: true);
|
||||
if (this.SelectedElement == null || this.SelectedElement.Root != currRoot) {
|
||||
var children = currRoot.Element.GetChildren(regardChildrensChildren: true).Append(currRoot.Element);
|
||||
if (this.SelectedElement?.Root != currRoot) {
|
||||
return backward ? children.LastOrDefault(c => c.CanBeSelected) : children.FirstOrDefault(c => c.CanBeSelected);
|
||||
} else {
|
||||
var foundCurr = false;
|
||||
|
|
Loading…
Reference in a new issue