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

Function InputScrollPartUpdateVThumb

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

* * rct2: 0x006E99A9 */

Source from the content-addressed store, hash-verified

815 * rct2: 0x006E99A9
816 */
817 static void InputScrollPartUpdateVThumb(WindowBase& w, WidgetIndex widgetIndex, int32_t y, int32_t scroll_id)
818 {
819 const auto& widget = w.widgets[widgetIndex];
820 auto& scroll = w.scrolls[scroll_id];
821
822 auto* windowMgr = GetWindowManager();
823 if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
824 {
825 int32_t newTop;
826 newTop = scroll.contentHeight;
827 newTop *= y;
828 y = widget.height() - 22;
829 if (scroll.flags & HSCROLLBAR_VISIBLE)
830 y -= kScrollBarWidth + 1;
831 newTop /= y;
832 y = newTop;
833 scroll.flags |= VSCROLLBAR_THUMB_PRESSED;
834 newTop = scroll.contentOffsetY;
835 newTop += y;
836 if (newTop < 0)
837 newTop = 0;
838 y = widget.height() - 2;
839 if (scroll.flags & HSCROLLBAR_VISIBLE)
840 y -= kScrollBarWidth + 1;
841 y *= -1;
842 y += scroll.contentHeight;
843 if (y < 0)
844 y = 0;
845 if (newTop > y)
846 newTop = y;
847 scroll.contentOffsetY = newTop;
848 widgetScrollUpdateThumbs(w, widgetIndex);
849 windowMgr->InvalidateWidgetByNumber(w.classification, w.number, widgetIndex);
850 }
851 }
852
853 /**
854 *

Callers 1

InputScrollContinueFunction · 0.85

Calls 5

GetWindowManagerFunction · 0.85
widgetScrollUpdateThumbsFunction · 0.85
heightMethod · 0.80
FindByNumberMethod · 0.45

Tested by

no test coverage detected