MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / InputScrollContinue

Function InputScrollContinue

src/openrct2-ui/input/MouseInput.cpp:710–765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

708 }
709
710 static void InputScrollContinue(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
711 {
712 int32_t scroll_part, scroll_id;
713
714 const auto& widget = w.widgets[widgetIndex];
715 if (w.classification != gPressedWidget.windowClassification || w.number != gPressedWidget.windowNumber
716 || widgetIndex != gPressedWidget.widgetIndex)
717 {
718 InvalidateScroll();
719 return;
720 }
721
722 ScreenCoordsXY newScreenCoords;
723 widgetScrollGetPart(w, &widget, screenCoords, newScreenCoords, &scroll_part, &scroll_id);
724
725 if (_currentScrollArea == SCROLL_PART_HSCROLLBAR_THUMB)
726 {
727 int32_t originalTooltipCursorX = gTooltipCursor.x;
728 gTooltipCursor.x = screenCoords.x;
729 InputScrollPartUpdateHThumb(w, widgetIndex, screenCoords.x - originalTooltipCursorX, scroll_id);
730 return;
731 }
732
733 if (_currentScrollArea == SCROLL_PART_VSCROLLBAR_THUMB)
734 {
735 int32_t originalTooltipCursorY = gTooltipCursor.y;
736 gTooltipCursor.y = screenCoords.y;
737 InputScrollPartUpdateVThumb(w, widgetIndex, screenCoords.y - originalTooltipCursorY, scroll_id);
738 return;
739 }
740
741 if (scroll_part != _currentScrollArea)
742 {
743 InvalidateScroll();
744 return;
745 }
746
747 switch (scroll_part)
748 {
749 case SCROLL_PART_VIEW:
750 w.onScrollMouseDrag(scroll_id, newScreenCoords);
751 break;
752 case SCROLL_PART_HSCROLLBAR_LEFT:
753 InputScrollPartUpdateHLeft(w, widgetIndex, scroll_id);
754 break;
755 case SCROLL_PART_HSCROLLBAR_RIGHT:
756 InputScrollPartUpdateHRight(w, widgetIndex, scroll_id);
757 break;
758 case SCROLL_PART_VSCROLLBAR_TOP:
759 InputScrollPartUpdateVTop(w, widgetIndex, scroll_id);
760 break;
761 case SCROLL_PART_VSCROLLBAR_BOTTOM:
762 InputScrollPartUpdateVBottom(w, widgetIndex, scroll_id);
763 break;
764 }
765 }
766
767 static void InputScrollEnd()

Callers 1

GameHandleInputMouseFunction · 0.85

Calls 9

InvalidateScrollFunction · 0.85
widgetScrollGetPartFunction · 0.85
onScrollMouseDragMethod · 0.45

Tested by

no test coverage detected