Fix error if nothing is selected

This commit is contained in:
Wojtek Figat
2022-10-23 14:19:17 +02:00
parent c6523ed9cd
commit 70c53a4f67

View File

@@ -209,16 +209,19 @@ namespace FlaxEditor.Windows
if (_sceneTreePanel.HScrollBar != null)
_sceneTreePanel.HScrollBar.ThumbEnabled = enabled;
}
/// <summary>
/// Scroll to selected node in the scene tree
/// Scrolls to the selected node in the scene tree.
/// </summary>
public void ScrollToSelectedNode()
{
// Scroll to node
// Scroll to node
var nodeSelection = _tree.Selection;
var scrollControl = nodeSelection[nodeSelection.Count - 1];
_sceneTreePanel.ScrollViewTo(scrollControl);
if (nodeSelection.Count != 0)
{
var scrollControl = nodeSelection[nodeSelection.Count - 1];
_sceneTreePanel.ScrollViewTo(scrollControl);
}
}
private void OnSearchBoxTextChanged()