Merge branch 'Tryibion-cursor-changes'
This commit is contained in:
@@ -56,6 +56,7 @@ namespace FlaxEditor.GUI.Input
|
||||
|
||||
private Float2 _startSlideLocation;
|
||||
private double _clickStartTime = -1;
|
||||
private bool _cursorChanged;
|
||||
|
||||
/// <summary>
|
||||
/// 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);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseLeave()
|
||||
{
|
||||
if (_cursorChanged)
|
||||
{
|
||||
Cursor = CursorType.Default;
|
||||
_cursorChanged = false;
|
||||
}
|
||||
|
||||
base.OnMouseLeave();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnEditBegin()
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace FlaxEngine.GUI
|
||||
private float _splitterValue;
|
||||
private Rectangle _splitterRect;
|
||||
private bool _splitterClicked, _mouseOverSplitter;
|
||||
private bool _cursorChanged;
|
||||
|
||||
/// <summary>
|
||||
/// 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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user