summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorPeterN <peter@fuzzle.org>2018-04-28 22:27:14 +0100
committerGitHub <noreply@github.com>2018-04-28 22:27:14 +0100
commitcfe6a8ea4fc38d58babcc6e7b67a9185ee66078c (patch)
tree866b6e14defd796b53551c1efe34a6c558a9699b /src/window.cpp
parent913119487fa58bb4346af8d0024f95b6517f4d46 (diff)
downloadopenttd-cfe6a8ea4fc38d58babcc6e7b67a9185ee66078c.tar.xz
Add: Replace independment map scrolling GUI settings with single option, and add choice to not lock cursor position when scrolling. (#6756)
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp12
1 files changed, 7 insertions, 5 deletions
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;