From 16aef0f705c5c7d6db017689f5d113bdbee14502 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Sun, 17 Mar 2024 17:11:36 -0500 Subject: [PATCH] Add deselecting by clicking no control. Add cursor changes when over widgets. --- Source/Editor/Gizmo/UIEditorGizmo.cs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Source/Editor/Gizmo/UIEditorGizmo.cs b/Source/Editor/Gizmo/UIEditorGizmo.cs index c7d37d78d..1ff7e687e 100644 --- a/Source/Editor/Gizmo/UIEditorGizmo.cs +++ b/Source/Editor/Gizmo/UIEditorGizmo.cs @@ -276,6 +276,11 @@ namespace FlaxEditor return true; } } + // Allow deselecting if user clicks on nothing + else + { + owner.Select(null); + } } if (EnableCamera && (button == MouseButton.Right || button == MouseButton.Middle)) { @@ -295,6 +300,24 @@ namespace FlaxEditor { base.OnMouseMove(location); + // Change cursor if mouse is over active control widget + bool cursorChanged = false; + if (_widgets != null && _widgets.Count != 0 && !_mouseMovesControl && !_mouseMovesWidget && !_mouseMovesView) + { + foreach (var widget in _widgets) + { + if (widget.Bounds.Contains(ref location)) + { + Cursor = widget.Cursor; + cursorChanged = true; + } + else if (Cursor != CursorType.Default && !cursorChanged) + { + Cursor = CursorType.Default; + } + } + } + var transformGizmo = TransformGizmo; if (_mouseMovesControl && transformGizmo != null) {