1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-24 17:29:23 +01:00

Fixed gamepad auto-nav angle being incorrect for some elements

This commit is contained in:
Ell 2022-05-26 11:39:55 +02:00
parent b9f2de8290
commit 951f4babd5
2 changed files with 2 additions and 1 deletions

View file

@ -43,6 +43,7 @@ Fixes
- Fixed elements not being deselected when removed through RemoveChild
- Fixed elements sometimes staying hidden when they shouldn't in scrolling panels
- Fixed elements' OnDeselected events not being raised when CanBeSelected is set to false while selected
- Fixed gamepad auto-nav angle being incorrect for some elements
Removals
- Marked old Draw and DrawTransformed overloads as obsolete in favor of SpriteBatchContext ones

View file

@ -415,7 +415,7 @@ namespace MLEM.Ui {
if (child == this.SelectedElement)
continue;
var (xOffset, yOffset) = child.Area.Center - this.SelectedElement.Area.Center;
var angle = Math.Abs(direction.Angle() - (float) Math.Atan2(yOffset, xOffset));
var angle = Math.Abs(MathHelper.WrapAngle(direction.Angle() - (float) Math.Atan2(yOffset, xOffset)));
if (angle >= MathHelper.PiOver2 - Element.Epsilon)
continue;
var distSq = child.Area.DistanceSquared(this.SelectedElement.Area);