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

Function wheelInput

src/OpenLoco/src/Ui/WindowManager.cpp:1290–1354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1288 }
1289
1290 void wheelInput(int wheel)
1291 {
1292 const Ui::Point cursorPosition = Input::getMouseLocation();
1293 auto window = findAt(cursorPosition);
1294
1295 if (window != nullptr)
1296 {
1297 if (window->type == WindowType::main)
1298 {
1299 if (SceneManager::isTitleMode())
1300 {
1301 return;
1302 }
1303
1304 if (wheel > 0)
1305 {
1306 window->viewportZoomOut(true);
1307 }
1308 else if (wheel < 0)
1309 {
1310 window->viewportZoomIn(true);
1311 }
1312 TownManager::updateLabels();
1313 StationManager::updateLabels();
1314
1315 return;
1316 }
1317 else
1318 {
1319 auto widgetIndex = window->findWidgetAt(cursorPosition.x, cursorPosition.y);
1320 if (widgetIndex != kWidgetIndexNull)
1321 {
1322 if (window->widgets[widgetIndex].type == WidgetType::scrollview)
1323 {
1324 auto scrollIndex = window->getScrollDataIndex(widgetIndex);
1325 constexpr ScrollFlags scrollbarFlags = ScrollFlags::hscrollbarVisible | ScrollFlags::vscrollbarVisible;
1326 if (window->scrollAreas[scrollIndex].hasFlags(scrollbarFlags))
1327 {
1328 windowScrollWheelInput(*window, widgetIndex, wheel);
1329 return;
1330 }
1331 }
1332
1333 if (stepperWheelInput(*window, widgetIndex, wheel))
1334 {
1335 return;
1336 }
1337
1338 if (windowWheelInput(*window, wheel))
1339 {
1340 return;
1341 }
1342 }
1343 }
1344 }
1345
1346 for (auto it = _windows.rbegin(); it != _windows.rend(); it++)
1347 {

Callers 1

processMouseWheelFunction · 0.85

Calls 14

getMouseLocationFunction · 0.85
findAtFunction · 0.85
isTitleModeFunction · 0.85
windowScrollWheelInputFunction · 0.85
stepperWheelInputFunction · 0.85
windowWheelInputFunction · 0.85
viewportZoomOutMethod · 0.80
viewportZoomInMethod · 0.80
findWidgetAtMethod · 0.80
getScrollDataIndexMethod · 0.80
rbeginMethod · 0.80
rendMethod · 0.80

Tested by

no test coverage detected