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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue