diff --git a/Source/Editor/GUI/Input/ValueBox.cs b/Source/Editor/GUI/Input/ValueBox.cs index 50cdd529c..1e9553d22 100644 --- a/Source/Editor/GUI/Input/ValueBox.cs +++ b/Source/Editor/GUI/Input/ValueBox.cs @@ -57,6 +57,7 @@ namespace FlaxEditor.GUI.Input private Float2 _startSlideLocation; private double _clickStartTime = -1; private bool _cursorChanged; + private Float2 _mouseClickedPosition; /// /// Occurs when value gets changed. @@ -244,8 +245,12 @@ namespace FlaxEditor.GUI.Input _startSlideLocation = location; _startSlideValue = _value; StartMouseCapture(true); - Cursor = CursorType.SizeWE; + + // Hide cursor and cache location + Cursor = CursorType.Hidden; + _mouseClickedPosition = location; _cursorChanged = true; + SlidingStart?.Invoke(); return true; } @@ -268,7 +273,7 @@ namespace FlaxEditor.GUI.Input } // Update cursor type so user knows they can slide value - if (CanUseSliding && SlideRect.Contains(location)) + if (CanUseSliding && SlideRect.Contains(location) && !_isSliding) { Cursor = CursorType.SizeWE; _cursorChanged = true; @@ -287,7 +292,8 @@ namespace FlaxEditor.GUI.Input { if (button == MouseButton.Left && _isSliding) { - // End sliding + // End sliding and return mouse to original location + Root.MousePosition = ScreenPos + _mouseClickedPosition; EndSliding(); return true; }