mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-26 06:28:35 +01:00
Prefer elements that have the same parent as the currently selected element when using gamepad navigation
This commit is contained in:
parent
45955bb5e8
commit
a14a37cb91
2 changed files with 3 additions and 1 deletions
|
@ -47,6 +47,7 @@ Improvements
|
||||||
- Allow ElementHelper's KeybindButton to query a combination at a given index
|
- Allow ElementHelper's KeybindButton to query a combination at a given index
|
||||||
- Automatically select the first element when a dropdown is opened in auto nav mode
|
- Automatically select the first element when a dropdown is opened in auto nav mode
|
||||||
- Improved gamepad navigation by employing angles between elements
|
- Improved gamepad navigation by employing angles between elements
|
||||||
|
- Prefer elements that have the same parent as the currently selected element when using gamepad navigation
|
||||||
|
|
||||||
Fixes
|
Fixes
|
||||||
- Fixed paragraph links having incorrect hover locations when using special text alignments
|
- Fixed paragraph links having incorrect hover locations when using special text alignments
|
||||||
|
|
|
@ -377,7 +377,8 @@ namespace MLEM.Ui {
|
||||||
if (Math.Abs(direction.Angle() - Math.Atan2(distVec.Y, distVec.X)) >= MathHelper.PiOver2 - Element.Epsilon)
|
if (Math.Abs(direction.Angle() - Math.Atan2(distVec.Y, distVec.X)) >= MathHelper.PiOver2 - Element.Epsilon)
|
||||||
continue;
|
continue;
|
||||||
var distSq = distVec.LengthSquared();
|
var distSq = distVec.LengthSquared();
|
||||||
if (closest == null || distSq < closestDistSq) {
|
// prefer navigating to elements that have the same parent as the currently selected element
|
||||||
|
if (closest == null || distSq < closestDistSq || closest.Parent != this.SelectedElement.Parent && child.Parent == this.SelectedElement.Parent) {
|
||||||
closest = child;
|
closest = child;
|
||||||
closestDistSq = distSq;
|
closestDistSq = distSq;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue