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.
This commit is contained in:
Robert Müller 2023-01-10 18:18:59 +01:00
parent 831b67e2cb
commit bbd20cde2b
2 changed files with 3 additions and 1 deletions

View file

@ -5,6 +5,7 @@
#include <engine/client.h>
#include <engine/keys.h>
#include <engine/shared/config.h>
#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))
{

View file

@ -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