Changed how cursor is set back to default, so it doesnt keep setting itself

This commit is contained in:
Chandler Cox
2022-09-30 20:52:04 -05:00
parent e18002dd03
commit 3867cb5e97
2 changed files with 7 additions and 24 deletions

View File

@@ -23,8 +23,7 @@ namespace FlaxEngine.GUI
private float _splitterValue;
private Rectangle _splitterRect;
private bool _splitterClicked, _mouseOverSplitter;
private bool _leftMouseButtonDown;
private bool _rightMouseButtonDown;
private bool _cursorChanged;
/// <summary>
/// The first panel (left or upper based on Orientation).
@@ -168,10 +167,12 @@ namespace FlaxEngine.GUI
else if (_mouseOverSplitter)
{
Cursor = _orientation == Orientation.Horizontal ? CursorType.SizeWE : CursorType.SizeNS;
_cursorChanged = true;
}
else if (!_leftMouseButtonDown && !_rightMouseButtonDown)
else if (_cursorChanged)
{
Cursor = CursorType.Default;
_cursorChanged = false;
}
base.OnMouseMove(location);
@@ -180,16 +181,6 @@ namespace FlaxEngine.GUI
/// <inheritdoc />
public override bool OnMouseDown(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
_leftMouseButtonDown = true;
}
if (button == MouseButton.Right)
{
_rightMouseButtonDown = true;
}
if (button == MouseButton.Left && _splitterRect.Contains(location))
{
// Start moving splitter
@@ -204,16 +195,6 @@ namespace FlaxEngine.GUI
/// <inheritdoc />
public override bool OnMouseUp(Float2 location, MouseButton button)
{
if (button == MouseButton.Left)
{
_leftMouseButtonDown = false;
}
if (button == MouseButton.Right)
{
_rightMouseButtonDown = false;
}
if (_splitterClicked)
{
EndTracking();