mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 12:58:33 +01:00
inflate view width and height for gamepad input to account for offscreen elements
This commit is contained in:
parent
5e3fdbb8ef
commit
f4f7df0eb8
1 changed files with 8 additions and 7 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue