Fixed small bug when moving a tab when close to the split panel splitter

This commit is contained in:
Chandler Cox
2022-10-05 21:16:54 -05:00
parent 3867cb5e97
commit aca5522245

View File

@@ -24,6 +24,7 @@ namespace FlaxEngine.GUI
private Rectangle _splitterRect; private Rectangle _splitterRect;
private bool _splitterClicked, _mouseOverSplitter; private bool _splitterClicked, _mouseOverSplitter;
private bool _cursorChanged; private bool _cursorChanged;
private bool _anyMouseButtonDown;
/// <summary> /// <summary>
/// The first panel (left or upper based on Orientation). /// The first panel (left or upper based on Orientation).
@@ -163,8 +164,9 @@ namespace FlaxEngine.GUI
{ {
SplitterValue = _orientation == Orientation.Horizontal ? location.X / Width : location.Y / Height; SplitterValue = _orientation == Orientation.Horizontal ? location.X / Width : location.Y / Height;
Cursor = _orientation == Orientation.Horizontal ? CursorType.SizeWE : CursorType.SizeNS; Cursor = _orientation == Orientation.Horizontal ? CursorType.SizeWE : CursorType.SizeNS;
_cursorChanged = true;
} }
else if (_mouseOverSplitter) else if (_mouseOverSplitter && !_anyMouseButtonDown)
{ {
Cursor = _orientation == Orientation.Horizontal ? CursorType.SizeWE : CursorType.SizeNS; Cursor = _orientation == Orientation.Horizontal ? CursorType.SizeWE : CursorType.SizeNS;
_cursorChanged = true; _cursorChanged = true;
@@ -181,6 +183,7 @@ namespace FlaxEngine.GUI
/// <inheritdoc /> /// <inheritdoc />
public override bool OnMouseDown(Float2 location, MouseButton button) public override bool OnMouseDown(Float2 location, MouseButton button)
{ {
_anyMouseButtonDown = true;
if (button == MouseButton.Left && _splitterRect.Contains(location)) if (button == MouseButton.Left && _splitterRect.Contains(location))
{ {
// Start moving splitter // Start moving splitter
@@ -195,6 +198,7 @@ namespace FlaxEngine.GUI
/// <inheritdoc /> /// <inheritdoc />
public override bool OnMouseUp(Float2 location, MouseButton button) public override bool OnMouseUp(Float2 location, MouseButton button)
{ {
_anyMouseButtonDown = false;
if (_splitterClicked) if (_splitterClicked)
{ {
EndTracking(); EndTracking();