From ebd88a407d50bcc90503256eba2361daf95fecc0 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 10 Oct 2022 18:47:38 +0200 Subject: [PATCH] Fix mouse leave event handling to restore cursor #759 --- Source/Editor/GUI/Input/ValueBox.cs | 19 +++++++++++++++++-- Source/Engine/UI/GUI/Panels/SplitPanel.cs | 5 +++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Source/Editor/GUI/Input/ValueBox.cs b/Source/Editor/GUI/Input/ValueBox.cs index 2b13742ee..b818c56d5 100644 --- a/Source/Editor/GUI/Input/ValueBox.cs +++ b/Source/Editor/GUI/Input/ValueBox.cs @@ -173,8 +173,11 @@ namespace FlaxEditor.GUI.Input { _isSliding = false; EndMouseCapture(); - Cursor = CursorType.Default; - _cursorChanged = false; + if (_cursorChanged) + { + Cursor = CursorType.Default; + _cursorChanged = false; + } SlidingEnd?.Invoke(); } @@ -300,6 +303,18 @@ namespace FlaxEditor.GUI.Input return base.OnMouseUp(location, button); } + /// + public override void OnMouseLeave() + { + if (_cursorChanged) + { + Cursor = CursorType.Default; + _cursorChanged = false; + } + + base.OnMouseLeave(); + } + /// protected override void OnEditBegin() { diff --git a/Source/Engine/UI/GUI/Panels/SplitPanel.cs b/Source/Engine/UI/GUI/Panels/SplitPanel.cs index 5fb8c410a..2a46846e8 100644 --- a/Source/Engine/UI/GUI/Panels/SplitPanel.cs +++ b/Source/Engine/UI/GUI/Panels/SplitPanel.cs @@ -210,6 +210,11 @@ namespace FlaxEngine.GUI { // Clear flag _mouseOverSplitter = false; + if (_cursorChanged) + { + Cursor = CursorType.Default; + _cursorChanged = false; + } base.OnMouseLeave(); }