Fix update order inconsistencies between machines by exposing an action for when defered layout happens.

This commit is contained in:
Zode
2025-06-08 00:38:59 +03:00
committed by GitHub
parent 568719b615
commit 1fa83639c2
2 changed files with 13 additions and 12 deletions

View File

@@ -73,6 +73,11 @@ namespace FlaxEditor.GUI.Tree
/// </summary>
public bool DrawRootTreeLine = true;
/// <summary>
/// Occurs when the defered layouting happens
/// </summary>
public event Action OnDeferedLayout;
/// <summary>
/// Gets or sets the margin for the child tree nodes.
/// </summary>
@@ -375,6 +380,7 @@ namespace FlaxEditor.GUI.Tree
if (_deferLayoutUpdate)
{
base.PerformLayout();
OnDeferedLayout?.Invoke();
_deferLayoutUpdate = false;
}

View File

@@ -92,6 +92,13 @@ namespace FlaxEditor.Windows
_tree.SelectedChanged += Tree_OnSelectedChanged;
_tree.RightClick += OnTreeRightClick;
_tree.Parent = _sceneTreePanel;
_tree.OnDeferedLayout += () => {
if(_tree.Selection.Count != 0 && _forceScrollNodeToView)
{
_forceScrollNodeToView = false;
ScrollToSelectedNode();
}
};
headerPanel.Parent = this;
// Setup input actions
@@ -156,18 +163,6 @@ namespace FlaxEditor.Windows
PerformLayout();
}
/// <inheritdoc />
public override void Update(float deltaTime)
{
base.Update(deltaTime);
if(_tree.Selection.Count != 0 && _forceScrollNodeToView)
{
_forceScrollNodeToView = false;
ScrollToSelectedNode();
}
}
private void Spawn(Type type)
{
// Create actor