MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / hTrackRight

Function hTrackRight

src/OpenLoco/src/Ui/ScrollView.cpp:372–383  ·  view source on GitHub ↗

0x004C8AA6

Source from the content-addressed store, hash-verified

370
371 // 0x004C8AA6
372 static void hTrackRight(Ui::Window& window, const size_t scrollAreaIndex, const WidgetIndex_t widgetIndex)
373 {
374 int16_t trackWidth = window.widgets[widgetIndex].width() - 2;
375 if (window.scrollAreas[scrollAreaIndex].hasFlags(ScrollFlags::vscrollbarVisible))
376 {
377 trackWidth -= kScrollbarSize;
378 }
379 int16_t widgetContentWidth = std::max(window.scrollAreas[scrollAreaIndex].contentWidth - trackWidth, 0);
380 window.scrollAreas[scrollAreaIndex].contentOffsetX = std::min<int16_t>(window.scrollAreas[scrollAreaIndex].contentOffsetX + trackWidth, widgetContentWidth);
381 ScrollView::updateThumbs(window, widgetIndex);
382 WindowManager::invalidateWidget(window.type, window.number, widgetIndex);
383 }
384
385 void verticalNudgeUp(Ui::Window& window, const size_t scrollAreaIndex, const WidgetIndex_t widgetIndex)
386 {

Callers 1

scrollLeftBeginFunction · 0.85

Calls 4

updateThumbsFunction · 0.85
invalidateWidgetFunction · 0.85
widthMethod · 0.45
hasFlagsMethod · 0.45

Tested by

no test coverage detected