/** * * rct2: 0x006E8ACB */ static void input_scroll_right(sint32 x, sint32 y, sint32 state) { rct_window* w = window_find_by_number(_dragWidget.window_classification, _dragWidget.window_number); if (w == NULL) { platform_show_cursor(); _inputState = INPUT_STATE_RESET; return; } switch (state) { case MOUSE_STATE_RELEASED: _ticksSinceDragStart += gTicksSinceLastUpdate; if (x != 0 || y != 0) { _ticksSinceDragStart = 1000; input_scroll_drag_continue(x, y, w); } break; case MOUSE_STATE_RIGHT_RELEASE: _inputState = INPUT_STATE_RESET; platform_show_cursor(); break; } }
/** * * rct2: 0x006E8ACB */ static void input_scroll_right(int x, int y, int state) { rct_window* w = window_find_by_number(_dragWidget.window_classification, _dragWidget.window_number); if (w == NULL) { platform_show_cursor(); gInputState = INPUT_STATE_RESET; return; } switch (state) { case MOUSE_STATE_RELEASED: _ticksSinceDragStart += RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, sint16); if (x != 0 || y != 0) { _ticksSinceDragStart = 1000; input_scroll_drag_continue(x, y, w); } break; case MOUSE_STATE_RIGHT_RELEASE: gInputState = INPUT_STATE_RESET; platform_show_cursor(); break; } }
static void input_viewport_drag_continue() { sint32 dx, dy, newDragX, newDragY; rct_window *w; rct_viewport *viewport; platform_get_cursor_position(&newDragX, &newDragY); dx = newDragX - gInputDragLastX; dy = newDragY - gInputDragLastY; w = window_find_by_number(_dragWidget.window_classification, _dragWidget.window_number); // #3294: Window can be closed during a drag session, so just finish // the session if the window no longer exists if (w == NULL) { input_viewport_drag_end(); return; } viewport = w->viewport; _ticksSinceDragStart += gTicksSinceLastUpdate; if (viewport == NULL) { platform_show_cursor(); _inputState = INPUT_STATE_RESET; } else if (dx != 0 || dy != 0) { if (!(w->flags & WF_NO_SCROLLING)) { // User dragged a scrollable viewport // If the drag time is less than 500 the "drag" is usually interpreted as a right click. // As the user moved the mouse, don't interpret it as right click in any case. _ticksSinceDragStart = 1000; dx *= 1 << (viewport->zoom + 1); dy *= 1 << (viewport->zoom + 1); if (gConfigGeneral.invert_viewport_drag){ w->saved_view_x -= dx; w->saved_view_y -= dy; } else { w->saved_view_x += dx; w->saved_view_y += dy; } } } platform_set_cursor_position(gInputDragLastX, gInputDragLastY); }
static void input_viewport_drag_end() { _inputState = INPUT_STATE_RESET; platform_show_cursor(); }