MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / OnMouseWheel

Method OnMouseWheel

src/smallmap_gui.cpp:1859–1869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1857 }
1858
1859 void OnMouseWheel(int wheel, WidgetID widget) override
1860 {
1861 if (widget != WID_SM_MAP) return;
1862 if (_settings_client.gui.scrollwheel_scrolling != SWS_OFF) {
1863 const NWidgetBase *wid = this->GetWidget<NWidgetBase>(WID_SM_MAP);
1864 int cursor_x = _cursor.pos.x - this->left - wid->pos_x;
1865 int cursor_y = _cursor.pos.y - this->top - wid->pos_y;
1866 Point pt = {cursor_x, cursor_y};
1867 this->SetZoomLevel((wheel < 0) ? ZLC_ZOOM_IN : ZLC_ZOOM_OUT, &pt);
1868 }
1869 }
1870
1871 void OnScroll(Point delta) override
1872 {

Callers

nothing calls this directly

Calls 2

SetZoomLevelMethod · 0.95

Tested by

no test coverage detected