Skip to content

Commit

Permalink
Touch layout clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
iota97 committed Apr 1, 2020
1 parent 115048e commit a4a1b05
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions UI/TouchControlLayoutScreen.cpp
Expand Up @@ -264,15 +264,9 @@ bool TouchControlLayoutScreen::touch(const TouchInput &touch) {
validRange.y += bounds.h * 0.5f;
validRange.h -= bounds.h;

// Check x and y independently, since even if x is blocked, y may not be.
if (validRange.Contains(touch.x, newPos.y) || validRange.Contains(touch.x, touch.y)) {
newPos.x = touch.x;
}
if (validRange.Contains(newPos.x, touch.y) || validRange.Contains(touch.x, touch.y)) {
newPos.y = touch.y;
}
newPos.x = touch.x;
newPos.y = touch.y;
if (g_Config.bTouchSnapToGrid) {
newPos = ClampTo(newPos, validRange);
newPos.x -= (int)(newPos.x - bounds.w) % g_Config.iTouchSnapGridSize;
newPos.y -= (int)(newPos.y - bounds.h) % g_Config.iTouchSnapGridSize;
}
Expand Down

0 comments on commit a4a1b05

Please sign in to comment.