1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-22 20:58:34 +01:00

inflate view width and height for gamepad input to account for offscreen elements

This commit is contained in:
Ellpeck 2020-03-17 15:24:33 +01:00
parent 5e3fdbb8ef
commit f4f7df0eb8

View file

@ -229,21 +229,22 @@ namespace MLEM.Ui {
RectangleF searchArea = default; RectangleF searchArea = default;
if (this.SelectedElement?.Root != null) { if (this.SelectedElement?.Root != null) {
searchArea = this.SelectedElement.Area; searchArea = this.SelectedElement.Area;
var (_, _, width, height) = this.System.Viewport; var view = this.System.Viewport;
view.Inflate(view.Width, view.Height);
switch (dir) { switch (dir) {
case Direction2.Down: case Direction2.Down:
searchArea.Height += height; searchArea.Height += view.Height;
break; break;
case Direction2.Left: case Direction2.Left:
searchArea.X -= width; searchArea.X -= view.Width;
searchArea.Width += width; searchArea.Width += view.Width;
break; break;
case Direction2.Right: case Direction2.Right:
searchArea.Width += width; searchArea.Width += view.Width;
break; break;
case Direction2.Up: case Direction2.Up:
searchArea.Y -= height; searchArea.Y -= view.Height;
searchArea.Height += height; searchArea.Height += view.Height;
break; break;
} }
} }