From 675ce71935afc097318312be3f24b18be55c5d5c Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Mon, 13 May 2024 12:45:59 -0500 Subject: [PATCH] Draw hover before selection so that way ui selection is drawn on top. --- Source/Editor/Gizmo/UIEditorGizmo.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/Editor/Gizmo/UIEditorGizmo.cs b/Source/Editor/Gizmo/UIEditorGizmo.cs index 572c19377..5b7535b5d 100644 --- a/Source/Editor/Gizmo/UIEditorGizmo.cs +++ b/Source/Editor/Gizmo/UIEditorGizmo.cs @@ -499,6 +499,15 @@ namespace FlaxEditor bool drawAnySelectedControl = false; var transformGizmo = TransformGizmo; var mousePos = PointFromWindow(RootWindow.MousePosition); + if (EnableSelecting && !_mouseMovesControl && !_mouseMovesWidget && IsMouseOver) + { + // Highlight control under mouse for easier selecting (except if already selected) + if (RayCastControl(ref mousePos, out var hitControl) && + (transformGizmo == null || !transformGizmo.Selection.Any(x => x.EditableObject is UIControl controlActor && controlActor.Control == hitControl))) + { + DrawControl(null, hitControl, false, ref mousePos, ref drawAnySelectedControl); + } + } if (transformGizmo != null) { // Selected UI controls outline @@ -511,15 +520,6 @@ namespace FlaxEditor } } } - if (EnableSelecting && !_mouseMovesControl && !_mouseMovesWidget && IsMouseOver) - { - // Highlight control under mouse for easier selecting (except if already selected) - if (RayCastControl(ref mousePos, out var hitControl) && - (transformGizmo == null || !transformGizmo.Selection.Any(x => x.EditableObject is UIControl controlActor && controlActor.Control == hitControl))) - { - DrawControl(null, hitControl, false, ref mousePos, ref drawAnySelectedControl); - } - } if (drawAnySelectedControl) Render2D.PopTransform();