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

Function InputScrollPartUpdateHThumb

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

* * rct2: 0x006E98F2 */

Source from the content-addressed store, hash-verified

775 * rct2: 0x006E98F2
776 */
777 static void InputScrollPartUpdateHThumb(WindowBase& w, WidgetIndex widgetIndex, int32_t x, int32_t scroll_id)
778 {
779 const auto& widget = w.widgets[widgetIndex];
780 auto& scroll = w.scrolls[scroll_id];
781
782 auto* windowMgr = GetWindowManager();
783 if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
784 {
785 int32_t newLeft;
786 newLeft = scroll.contentWidth;
787 newLeft *= x;
788 x = widget.width() - 22;
789 if (scroll.flags & VSCROLLBAR_VISIBLE)
790 x -= kScrollBarWidth + 1;
791 newLeft /= x;
792 x = newLeft;
793 scroll.flags |= HSCROLLBAR_THUMB_PRESSED;
794 newLeft = scroll.contentOffsetX;
795 newLeft += x;
796 if (newLeft < 0)
797 newLeft = 0;
798 x = widget.width() - 2;
799 if (scroll.flags & VSCROLLBAR_VISIBLE)
800 x -= kScrollBarWidth + 1;
801 x *= -1;
802 x += scroll.contentWidth;
803 if (x < 0)
804 x = 0;
805 if (newLeft > x)
806 newLeft = x;
807 scroll.contentOffsetX = newLeft;
808 widgetScrollUpdateThumbs(w, widgetIndex);
809 windowMgr->InvalidateWidgetByNumber(w.classification, w.number, widgetIndex);
810 }
811 }
812
813 /**
814 *

Callers 1

InputScrollContinueFunction · 0.85

Calls 5

GetWindowManagerFunction · 0.85
widgetScrollUpdateThumbsFunction · 0.85
widthMethod · 0.80
FindByNumberMethod · 0.45

Tested by

no test coverage detected