Merge branch 'value-box-cursor-change' of https://github.com/Tryibion/FlaxEngine into Tryibion-value-box-cursor-change

This commit is contained in:
Wojtek Figat
2022-10-23 23:45:13 +02:00

View File

@@ -57,6 +57,7 @@ namespace FlaxEditor.GUI.Input
private Float2 _startSlideLocation;
private double _clickStartTime = -1;
private bool _cursorChanged;
private Float2 _mouseClickedPosition;
/// <summary>
/// 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;
}