From 9e1695aa1e8079fc46d05af25a26917cfd678deb Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 5 Feb 2011 16:36:37 +0000 Subject: (svn r21977) -Codechange: Always cal Window::OnMouseWheel(), independent of viewport scroll/zoom settings. --- src/main_gui.cpp | 4 +++- src/smallmap_gui.cpp | 14 ++++++++------ src/viewport_gui.cpp | 4 +++- src/window.cpp | 6 ++---- 4 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/main_gui.cpp b/src/main_gui.cpp index e12f417e8..ee135f686 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -421,7 +421,9 @@ struct MainWindow : Window virtual void OnMouseWheel(int wheel) { - ZoomInOrOutToCursorWindow(wheel < 0, this); + if (_settings_client.gui.scrollwheel_scrolling == 0) { + ZoomInOrOutToCursorWindow(wheel < 0, this); + } } virtual void OnResize() diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 576abd3d2..7cc9f540f 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1461,12 +1461,14 @@ public: virtual void OnMouseWheel(int wheel) { - const NWidgetBase *wid = this->GetWidget(SM_WIDGET_MAP); - int cursor_x = _cursor.pos.x - this->left - wid->pos_x; - int cursor_y = _cursor.pos.y - this->top - wid->pos_y; - if (IsInsideMM(cursor_x, 0, wid->current_x) && IsInsideMM(cursor_y, 0, wid->current_y)) { - Point pt = {cursor_x, cursor_y}; - this->SetZoomLevel((wheel < 0) ? ZLC_ZOOM_IN : ZLC_ZOOM_OUT, &pt); + if (_settings_client.gui.scrollwheel_scrolling == 0) { + const NWidgetBase *wid = this->GetWidget(SM_WIDGET_MAP); + int cursor_x = _cursor.pos.x - this->left - wid->pos_x; + int cursor_y = _cursor.pos.y - this->top - wid->pos_y; + if (IsInsideMM(cursor_x, 0, wid->current_x) && IsInsideMM(cursor_y, 0, wid->current_y)) { + Point pt = {cursor_x, cursor_y}; + this->SetZoomLevel((wheel < 0) ? ZLC_ZOOM_IN : ZLC_ZOOM_OUT, &pt); + } } } diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp index 179ce14bf..1a85311b6 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -143,7 +143,9 @@ public: virtual void OnMouseWheel(int wheel) { - ZoomInOrOutToCursorWindow(wheel < 0, this); + if (_settings_client.gui.scrollwheel_scrolling == 0) { + ZoomInOrOutToCursorWindow(wheel < 0, this); + } } virtual void OnInvalidateData(int data = 0) diff --git a/src/window.cpp b/src/window.cpp index 5630a29ac..d6bdf4ffb 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2184,10 +2184,8 @@ static void MouseLoop(MouseClick click, int mousewheel) if (vp != NULL && (_game_mode == GM_MENU || IsGeneratingWorld())) return; if (mousewheel != 0) { - if (_settings_client.gui.scrollwheel_scrolling == 0) { - /* Send mousewheel event to window */ - w->OnMouseWheel(mousewheel); - } + /* Send mousewheel event to window */ + w->OnMouseWheel(mousewheel); /* Dispatch a MouseWheelEvent for widgets if it is not a viewport */ if (vp == NULL) DispatchMouseWheelEvent(w, w->nested_root->GetWidgetFromPos(x - w->left, y - w->top), mousewheel); -- cgit v1.2.3-70-g09d2