(svn r21977) -Codechange: Always cal Window::OnMouseWheel(), independent of viewport scroll/zoom settings.

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
frosch 14 years ago
parent b992a93996
commit 9e1695aa1e

@ -421,7 +421,9 @@ struct MainWindow : Window
virtual void OnMouseWheel(int wheel) virtual void OnMouseWheel(int wheel)
{ {
ZoomInOrOutToCursorWindow(wheel < 0, this); if (_settings_client.gui.scrollwheel_scrolling == 0) {
ZoomInOrOutToCursorWindow(wheel < 0, this);
}
} }
virtual void OnResize() virtual void OnResize()

@ -1461,12 +1461,14 @@ public:
virtual void OnMouseWheel(int wheel) virtual void OnMouseWheel(int wheel)
{ {
const NWidgetBase *wid = this->GetWidget<NWidgetBase>(SM_WIDGET_MAP); if (_settings_client.gui.scrollwheel_scrolling == 0) {
int cursor_x = _cursor.pos.x - this->left - wid->pos_x; const NWidgetBase *wid = this->GetWidget<NWidgetBase>(SM_WIDGET_MAP);
int cursor_y = _cursor.pos.y - this->top - wid->pos_y; int cursor_x = _cursor.pos.x - this->left - wid->pos_x;
if (IsInsideMM(cursor_x, 0, wid->current_x) && IsInsideMM(cursor_y, 0, wid->current_y)) { int cursor_y = _cursor.pos.y - this->top - wid->pos_y;
Point pt = {cursor_x, cursor_y}; if (IsInsideMM(cursor_x, 0, wid->current_x) && IsInsideMM(cursor_y, 0, wid->current_y)) {
this->SetZoomLevel((wheel < 0) ? ZLC_ZOOM_IN : ZLC_ZOOM_OUT, &pt); Point pt = {cursor_x, cursor_y};
this->SetZoomLevel((wheel < 0) ? ZLC_ZOOM_IN : ZLC_ZOOM_OUT, &pt);
}
} }
} }

@ -143,7 +143,9 @@ public:
virtual void OnMouseWheel(int wheel) 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) virtual void OnInvalidateData(int data = 0)

@ -2184,10 +2184,8 @@ static void MouseLoop(MouseClick click, int mousewheel)
if (vp != NULL && (_game_mode == GM_MENU || IsGeneratingWorld())) return; if (vp != NULL && (_game_mode == GM_MENU || IsGeneratingWorld())) return;
if (mousewheel != 0) { if (mousewheel != 0) {
if (_settings_client.gui.scrollwheel_scrolling == 0) { /* Send mousewheel event to window */
/* Send mousewheel event to window */ w->OnMouseWheel(mousewheel);
w->OnMouseWheel(mousewheel);
}
/* Dispatch a MouseWheelEvent for widgets if it is not a viewport */ /* 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); if (vp == NULL) DispatchMouseWheelEvent(w, w->nested_root->GetWidgetFromPos(x - w->left, y - w->top), mousewheel);

Loading…
Cancel
Save