mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-30 10:15:36 +01:00
* Fix #1496: scrolling on touch devices * correct formatting errors
This commit is contained in:
committed by
Michał Janiszewski
parent
8e6eb08275
commit
c1cd8619e0
@@ -302,7 +302,6 @@ public:
|
||||
_cursorState.middle &= ~CURSOR_CHANGED;
|
||||
_cursorState.right &= ~CURSOR_CHANGED;
|
||||
_cursorState.old = 0;
|
||||
_cursorState.touch = false;
|
||||
|
||||
SDL_Event e;
|
||||
while (SDL_PollEvent(&e))
|
||||
@@ -401,6 +400,7 @@ public:
|
||||
_cursorState.old = 2;
|
||||
break;
|
||||
}
|
||||
_cursorState.touch = false;
|
||||
break;
|
||||
}
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
@@ -427,6 +427,7 @@ public:
|
||||
_cursorState.old = 4;
|
||||
break;
|
||||
}
|
||||
_cursorState.touch = false;
|
||||
break;
|
||||
}
|
||||
// Apple sends touchscreen events for trackpads, so ignore these events on macOS
|
||||
|
||||
@@ -537,6 +537,7 @@ static void input_viewport_drag_continue()
|
||||
rct_viewport* viewport;
|
||||
|
||||
context_get_cursor_position(&newDragX, &newDragY);
|
||||
const CursorState* cursorState = context_get_cursor_state();
|
||||
|
||||
dx = newDragX - gInputDragLastX;
|
||||
dy = newDragY - gInputDragLastY;
|
||||
@@ -582,7 +583,15 @@ static void input_viewport_drag_continue()
|
||||
}
|
||||
}
|
||||
|
||||
context_set_cursor_position(gInputDragLastX, gInputDragLastY);
|
||||
if (cursorState->touch)
|
||||
{
|
||||
gInputDragLastX = newDragX;
|
||||
gInputDragLastY = newDragY;
|
||||
}
|
||||
else
|
||||
{
|
||||
context_set_cursor_position(gInputDragLastX, gInputDragLastY);
|
||||
}
|
||||
}
|
||||
|
||||
static void input_viewport_drag_end()
|
||||
|
||||
Reference in New Issue
Block a user