From f4f7df0eb8ba74ac850c11110a471b982c17f08f Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 17 Mar 2020 15:24:33 +0100 Subject: [PATCH] inflate view width and height for gamepad input to account for offscreen elements --- MLEM.Ui/UiControls.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/MLEM.Ui/UiControls.cs b/MLEM.Ui/UiControls.cs index 36332fb..3f94e7d 100644 --- a/MLEM.Ui/UiControls.cs +++ b/MLEM.Ui/UiControls.cs @@ -229,21 +229,22 @@ namespace MLEM.Ui { RectangleF searchArea = default; if (this.SelectedElement?.Root != null) { searchArea = this.SelectedElement.Area; - var (_, _, width, height) = this.System.Viewport; + var view = this.System.Viewport; + view.Inflate(view.Width, view.Height); switch (dir) { case Direction2.Down: - searchArea.Height += height; + searchArea.Height += view.Height; break; case Direction2.Left: - searchArea.X -= width; - searchArea.Width += width; + searchArea.X -= view.Width; + searchArea.Width += view.Width; break; case Direction2.Right: - searchArea.Width += width; + searchArea.Width += view.Width; break; case Direction2.Up: - searchArea.Y -= height; - searchArea.Height += height; + searchArea.Y -= view.Height; + searchArea.Height += view.Height; break; } }