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

Function scrollLeftContinue

src/OpenLoco/src/Ui/ScrollView.cpp:521–578  ·  view source on GitHub ↗

0x004C7236

Source from the content-addressed store, hash-verified

519
520 // 0x004C7236
521 void scrollLeftContinue(const int16_t x, const int16_t y, Ui::Window& window, Ui::Widget* const widget, const WidgetIndex_t widgetIndex)
522 {
523 if (_currentScrollArea == ScrollPart::hscrollbarThumb)
524 {
525 auto toolTipLoc = Ui::ToolTip::getTooltipMouseLocation();
526 int16_t deltaX = x - toolTipLoc.x;
527 toolTipLoc.x = x;
528 Ui::ToolTip::setTooltipMouseLocation(toolTipLoc);
529 ScrollView::horizontalFollow(window, widget, widgetIndex, _currentScrollIndex, deltaX);
530 }
531 else if (_currentScrollArea == ScrollPart::vscrollbarThumb)
532 {
533 auto toolTipLoc = Ui::ToolTip::getTooltipMouseLocation();
534 int16_t deltaY = y - toolTipLoc.y;
535 toolTipLoc.y = y;
536 Ui::ToolTip::setTooltipMouseLocation(toolTipLoc);
537 ScrollView::verticalFollow(window, widget, widgetIndex, _currentScrollIndex, deltaY);
538 }
539 else
540 {
541 auto res = getPart(window, widget, x, y);
542 if (res.area != _currentScrollArea)
543 {
544 clearPressedButtons(window.type, window.number, widgetIndex);
545 return;
546 }
547
548 switch (res.area)
549 {
550 case ScrollPart::view: // 0x004C729A
551 window.callScrollMouseDrag(res.scrollviewLoc.x, res.scrollviewLoc.y, static_cast<uint8_t>(res.index));
552 break;
553
554 case ScrollPart::hscrollbarButtonLeft:
555 hButtonLeft(window, res.index, widgetIndex);
556 break;
557 case ScrollPart::hscrollbarButtonRight:
558 hButtonRight(window, res.index, widgetIndex);
559 break;
560 case ScrollPart::hscrollbarTrackLeft:
561 case ScrollPart::hscrollbarTrackRight:
562 break;
563
564 case ScrollPart::vscrollbarButtonTop:
565 vButtonTop(window, res.index, widgetIndex);
566 break;
567 case ScrollPart::vscrollbarButtonBottom:
568 vButtonBottom(window, res.index, widgetIndex);
569 break;
570 case ScrollPart::vscrollbarTrackTop:
571 case ScrollPart::vscrollbarTrackBottom:
572 break;
573
574 default:
575 break;
576 }
577 }
578 }

Callers 1

stateScrollLeftFunction · 0.85

Calls 11

getTooltipMouseLocationFunction · 0.85
setTooltipMouseLocationFunction · 0.85
horizontalFollowFunction · 0.85
verticalFollowFunction · 0.85
getPartFunction · 0.85
clearPressedButtonsFunction · 0.85
hButtonLeftFunction · 0.85
hButtonRightFunction · 0.85
vButtonTopFunction · 0.85
vButtonBottomFunction · 0.85
callScrollMouseDragMethod · 0.80

Tested by

no test coverage detected