diff --git a/VocaluxeLib/Menu/CSelectSlide.cs b/VocaluxeLib/Menu/CSelectSlide.cs index 19d5d924..5a4f1a78 100644 --- a/VocaluxeLib/Menu/CSelectSlide.cs +++ b/VocaluxeLib/Menu/CSelectSlide.cs @@ -104,6 +104,8 @@ namespace VocaluxeLib.Menu public bool Visible = true; public bool Highlighted; + public bool SelectionByHover; + private bool _ArrowLeftSelected; private bool _ArrowRightSelected; @@ -114,7 +116,7 @@ namespace VocaluxeLib.Menu private readonly List _ValueBounds = new List(); - public readonly bool WithTextures; + public bool WithTextures; private int _Selection = -1; public int Selection @@ -654,6 +656,27 @@ namespace VocaluxeLib.Menu { _ArrowLeftSelected = CHelper.IsInBounds(RectArrowLeft, x, y) && _Selection > 0; _ArrowRightSelected = CHelper.IsInBounds(RectArrowRight, x, y) && _Selection < _ValueNames.Count - 1; + + if (SelectionByHover) + { + for (int i = 0; i < _ValueBounds.Count; i++) + { + if (CHelper.IsInBounds(_ValueBounds[i], x, y)) + { + int offset = _Selection - _NumVisible / 2; + + if (_ValueNames.Count - _NumVisible - offset < 0) + offset = _ValueNames.Count - _NumVisible; + + if (offset < 0) + offset = 0; + + Selection = i + offset; + _ValueBounds.Clear(); + break; + } + } + } } public void ProcessMouseLBClick(int x, int y)