From bbd20cde2b5643e3949a8d9984465c4b712288fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Tue, 10 Jan 2023 18:18:59 +0100 Subject: [PATCH] Add `ui_smooth_scroll_time` variable to adjust smooth scrolling This variable adjusts the time for smooth scrolling of all scrollregions and listboxes in the menus and editor. The value `0` disables smooth scrolling entirely. --- src/game/client/ui_scrollregion.cpp | 3 ++- src/game/variables.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/client/ui_scrollregion.cpp b/src/game/client/ui_scrollregion.cpp index b8bdd4c8e..03798e0da 100644 --- a/src/game/client/ui_scrollregion.cpp +++ b/src/game/client/ui_scrollregion.cpp @@ -5,6 +5,7 @@ #include #include +#include #include "ui_scrollregion.h" @@ -67,7 +68,7 @@ void CScrollRegion::End() CUIRect RegionRect = m_ClipRect; RegionRect.w += m_Params.m_ScrollbarWidth; - const float AnimationDuration = 0.5f; + const float AnimationDuration = g_Config.m_UiSmoothScrollTime / 1000.0f; if(UI()->Enabled() && UI()->MouseHovered(&RegionRect)) { diff --git a/src/game/variables.h b/src/game/variables.h index 0513df5d8..68a2f6bec 100644 --- a/src/game/variables.h +++ b/src/game/variables.h @@ -131,6 +131,7 @@ MACRO_CONFIG_INT(UiToolboxPage, ui_toolbox_page, 0, 0, 2, CFGFLAG_CLIENT | CFGFL MACRO_CONFIG_STR(UiServerAddress, ui_server_address, 1024, "localhost:8303", CFGFLAG_CLIENT | CFGFLAG_SAVE | CFGFLAG_INSENSITIVE, "Interface server address") MACRO_CONFIG_INT(UiMousesens, ui_mousesens, 200, 1, 100000, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Mouse sensitivity for menus/editor") MACRO_CONFIG_INT(UiControllerSens, ui_controller_sens, 100, 1, 100000, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Controller sensitivity for menus/editor") +MACRO_CONFIG_INT(UiSmoothScrollTime, ui_smooth_scroll_time, 500, 0, 5000, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Time of smooth scrolling animation in menus/editor in ms (0 for off)") MACRO_CONFIG_COL(UiColor, ui_color, 0xE4A046AF, CFGFLAG_CLIENT | CFGFLAG_SAVE | CFGFLAG_COLALPHA, "Interface color") // 160 70 175 228 hasalpha