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

Method findWidgetAt

src/OpenLoco/src/Ui/Window.cpp:910–960  ·  view source on GitHub ↗

0x004C9513

Source from the content-addressed store, hash-verified

908
909 // 0x004C9513
910 WidgetIndex_t Window::findWidgetAt(int16_t xPos, int16_t yPos)
911 {
912 this->callPrepareDraw();
913
914 WidgetIndex_t activeWidget = kWidgetIndexNull;
915
916 WidgetIndex_t widgetIndex = kWidgetIndexNull;
917 for (auto& widget : widgets)
918 {
919 widgetIndex++;
920
921 if (widget.type == WidgetType::empty || widget.hidden)
922 {
923 continue;
924 }
925
926 if (xPos < this->x + widget.left)
927 {
928 continue;
929 }
930
931 if (xPos > this->x + widget.right)
932 {
933 continue;
934 }
935
936 if (yPos < this->y + widget.top)
937 {
938 continue;
939 }
940
941 if (yPos > this->y + widget.bottom)
942 {
943 continue;
944 }
945
946 activeWidget = widgetIndex;
947 }
948
949 if (activeWidget == kWidgetIndexNull)
950 {
951 return kWidgetIndexNull;
952 }
953
954 if (this->widgets[activeWidget].type == WidgetType::combobox)
955 {
956 activeWidget++;
957 }
958
959 return activeWidget;
960 }
961
962 void Window::callClose()
963 {

Callers 11

findAtFunction · 0.80
findAtAltFunction · 0.80
wheelInputFunction · 0.80
onUpdateFunction · 0.80
scrollDragFunction · 0.80
scrollDragEndFunction · 0.80
onUpdateFunction · 0.80
onUpdateFunction · 0.80
toolDragFunction · 0.80
handleMouseFunction · 0.80
processMouseOverFunction · 0.80

Calls 1

callPrepareDrawMethod · 0.95

Tested by

no test coverage detected