From cfe6a8ea4fc38d58babcc6e7b67a9185ee66078c Mon Sep 17 00:00:00 2001 From: PeterN Date: Sat, 28 Apr 2018 22:27:14 +0100 Subject: Add: Replace independment map scrolling GUI settings with single option, and add choice to not lock cursor position when scrolling. (#6756) --- src/window.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/window.cpp') diff --git a/src/window.cpp b/src/window.cpp index f4b7a1ca1..30c1b8705 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2442,7 +2442,7 @@ static EventState HandleViewportScroll() * outside of the window and should not left-mouse scroll anymore. */ if (_last_scroll_window == NULL) _last_scroll_window = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y); - if (_last_scroll_window == NULL || !(_right_button_down || scrollwheel_scrolling || (_settings_client.gui.left_mouse_btn_scrolling && _left_button_down))) { + if (_last_scroll_window == NULL || !((_settings_client.gui.scroll_mode != VSM_MAP_LMB && _right_button_down) || scrollwheel_scrolling || (_settings_client.gui.scroll_mode == VSM_MAP_LMB && _left_button_down))) { _cursor.fix_at = false; _scrolling_viewport = false; _last_scroll_window = NULL; @@ -2457,7 +2457,7 @@ static EventState HandleViewportScroll() } Point delta; - if (_settings_client.gui.reverse_scroll || (_settings_client.gui.left_mouse_btn_scrolling && _left_button_down)) { + if (_settings_client.gui.scroll_mode != VSM_VIEWPORT_RMB_FIXED) { delta.x = -_cursor.delta.x; delta.y = -_cursor.delta.y; } else { @@ -2872,7 +2872,7 @@ static void MouseLoop(MouseClick click, int mousewheel) case MC_LEFT: if (HandleViewportClicked(vp, x, y)) return; if (!(w->flags & WF_DISABLE_VP_SCROLL) && - _settings_client.gui.left_mouse_btn_scrolling) { + _settings_client.gui.scroll_mode == VSM_MAP_LMB) { _scrolling_viewport = true; _cursor.fix_at = false; return; @@ -2880,9 +2880,11 @@ static void MouseLoop(MouseClick click, int mousewheel) break; case MC_RIGHT: - if (!(w->flags & WF_DISABLE_VP_SCROLL)) { + if (!(w->flags & WF_DISABLE_VP_SCROLL) && + _settings_client.gui.scroll_mode != VSM_MAP_LMB) { _scrolling_viewport = true; - _cursor.fix_at = true; + _cursor.fix_at = (_settings_client.gui.scroll_mode == VSM_VIEWPORT_RMB_FIXED || + _settings_client.gui.scroll_mode == VSM_MAP_RMB_FIXED); /* clear 2D scrolling caches before we start a 2D scroll */ _cursor.h_wheel = 0; -- cgit v1.2.3-54-g00ecf