Fixes for UI editor changes

This commit is contained in:
Wojtek Figat
2024-03-18 15:32:42 +01:00
parent 795527576b
commit 91298fee19
3 changed files with 10 additions and 5 deletions

View File

@@ -21,9 +21,12 @@ namespace FlaxEditor
public void ShowActors(IEnumerable<Actor> actors)
{
var root = UIEditor.UIRoot;
if (root == null)
return;
// Calculate bounds of all selected objects
var areaRect = Rectangle.Empty;
var root = UIEditor.UIRoot;
foreach (var actor in actors)
{
Rectangle bounds;
@@ -163,7 +166,7 @@ namespace FlaxEditor
/// <summary>
/// True if enable panning and zooming the view.
/// </summary>
public bool EnableCamera => _view != null;
public bool EnableCamera => _view != null && EnableBackground;
/// <summary>
/// Transform gizmo to use sync with (selection, snapping, transformation settings).
@@ -293,7 +296,7 @@ namespace FlaxEditor
return true;
}
return false;
return Focus(this);
}
public override void OnMouseMove(Float2 location)
@@ -467,7 +470,7 @@ namespace FlaxEditor
public override void Draw()
{
if (EnableBackground)
if (EnableBackground && _view != null)
{
// Draw background
Surface.VisjectSurface.DrawBackgroundDefault(Editor.Instance.UI.VisjectSurfaceBackground, Width, Height);

View File

@@ -1537,7 +1537,7 @@ namespace FlaxEditor.Viewport
}
bool useMouse = IsControllingMouse || (Mathf.IsInRange(_viewMousePos.X, 0, Width) && Mathf.IsInRange(_viewMousePos.Y, 0, Height));
_prevInput = _input;
var hit = GetChildAt(_viewMousePos, c => c.Visible && !(c is CanvasRootControl));
var hit = GetChildAt(_viewMousePos, c => c.Visible && !(c is CanvasRootControl) && !(c is UIEditorRoot));
if (canUseInput && ContainsFocus && hit == null)
_input.Gather(win.Window, useMouse);
else

View File

@@ -114,6 +114,8 @@ namespace FlaxEditor.Viewport.Previews
_uiControlLinked = uiControl;
_hasUILinked = true;
}
else if (_uiControlLinked != null)
_hasUILinked = true;
}
private void LinkCanvas(Actor actor)