From 3867cb5e9758d53b873e3b06776fa163a9da2af1 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Fri, 30 Sep 2022 20:52:04 -0500 Subject: [PATCH] Changed how cursor is set back to default, so it doesnt keep setting itself --- Source/Editor/GUI/Input/ValueBox.cs | 4 +++- Source/Engine/UI/GUI/Panels/SplitPanel.cs | 27 ++++------------------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/Source/Editor/GUI/Input/ValueBox.cs b/Source/Editor/GUI/Input/ValueBox.cs index 4b9ef8a51..4836b41c5 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. @@ -263,8 +264,9 @@ namespace FlaxEditor.GUI.Input if (CanUseSliding && SlideRect.Contains(location)) { Cursor = CursorType.SizeWE; + _cursorChanged = true; } - else if (!_isSliding) + else if (_cursorChanged && !_isSliding) { Cursor = CursorType.Default; } diff --git a/Source/Engine/UI/GUI/Panels/SplitPanel.cs b/Source/Engine/UI/GUI/Panels/SplitPanel.cs index bf79cb86c..4b15c38db 100644 --- a/Source/Engine/UI/GUI/Panels/SplitPanel.cs +++ b/Source/Engine/UI/GUI/Panels/SplitPanel.cs @@ -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; /// /// 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 /// 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 /// public override bool OnMouseUp(Float2 location, MouseButton button) { - if (button == MouseButton.Left) - { - _leftMouseButtonDown = false; - } - - if (button == MouseButton.Right) - { - _rightMouseButtonDown = false; - } - if (_splitterClicked) { EndTracking();