diff --git a/Source/Editor/GUI/Input/ValueBox.cs b/Source/Editor/GUI/Input/ValueBox.cs index ff824d76c..b818c56d5 100644 --- a/Source/Editor/GUI/Input/ValueBox.cs +++ b/Source/Editor/GUI/Input/ValueBox.cs @@ -56,6 +56,7 @@ namespace FlaxEditor.GUI.Input private Float2 _startSlideLocation; private double _clickStartTime = -1; + private bool _cursorChanged; /// /// Occurs when value gets changed. @@ -172,6 +173,11 @@ namespace FlaxEditor.GUI.Input { _isSliding = false; EndMouseCapture(); + if (_cursorChanged) + { + Cursor = CursorType.Default; + _cursorChanged = false; + } SlidingEnd?.Invoke(); } @@ -222,6 +228,8 @@ namespace FlaxEditor.GUI.Input // Update UpdateText(); } + + Cursor = CursorType.Default; ResetViewOffset(); } @@ -236,6 +244,8 @@ namespace FlaxEditor.GUI.Input _startSlideLocation = location; _startSlideValue = _value; StartMouseCapture(true); + Cursor = CursorType.SizeWE; + _cursorChanged = true; SlidingStart?.Invoke(); return true; } @@ -256,6 +266,18 @@ namespace FlaxEditor.GUI.Input ApplySliding(Mathf.RoundToInt(slideLocation.X - _startSlideLocation.X) * _slideSpeed); return; } + + // Update cursor type so user knows they can slide value + if (CanUseSliding && SlideRect.Contains(location)) + { + Cursor = CursorType.SizeWE; + _cursorChanged = true; + } + else if (_cursorChanged && !_isSliding) + { + Cursor = CursorType.Default; + _cursorChanged = false; + } base.OnMouseMove(location); } @@ -281,6 +303,18 @@ namespace FlaxEditor.GUI.Input return base.OnMouseUp(location, button); } + /// + public override void OnMouseLeave() + { + if (_cursorChanged) + { + Cursor = CursorType.Default; + _cursorChanged = false; + } + + base.OnMouseLeave(); + } + /// protected override void OnEditBegin() { diff --git a/Source/Engine/UI/GUI/Panels/SplitPanel.cs b/Source/Engine/UI/GUI/Panels/SplitPanel.cs index 8772c78e6..2a46846e8 100644 --- a/Source/Engine/UI/GUI/Panels/SplitPanel.cs +++ b/Source/Engine/UI/GUI/Panels/SplitPanel.cs @@ -23,6 +23,7 @@ namespace FlaxEngine.GUI private float _splitterValue; private Rectangle _splitterRect; private bool _splitterClicked, _mouseOverSplitter; + private bool _cursorChanged; /// /// The first panel (left or upper based on Orientation). @@ -161,6 +162,18 @@ namespace FlaxEngine.GUI if (_splitterClicked) { SplitterValue = _orientation == Orientation.Horizontal ? location.X / Width : location.Y / Height; + Cursor = _orientation == Orientation.Horizontal ? CursorType.SizeWE : CursorType.SizeNS; + _cursorChanged = true; + } + else if (_mouseOverSplitter) + { + Cursor = _orientation == Orientation.Horizontal ? CursorType.SizeWE : CursorType.SizeNS; + _cursorChanged = true; + } + else if (_cursorChanged) + { + Cursor = CursorType.Default; + _cursorChanged = false; } base.OnMouseMove(location); @@ -197,6 +210,11 @@ namespace FlaxEngine.GUI { // Clear flag _mouseOverSplitter = false; + if (_cursorChanged) + { + Cursor = CursorType.Default; + _cursorChanged = false; + } base.OnMouseLeave(); }