From 585b6bacad67e6386459200dd8e4d97ed8a3c156 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 4 Nov 2023 19:26:46 +0100 Subject: [PATCH] Simplify #1807 --- Source/Editor/SceneGraph/GUI/ActorTreeNode.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/Editor/SceneGraph/GUI/ActorTreeNode.cs b/Source/Editor/SceneGraph/GUI/ActorTreeNode.cs index 1f2189346..f64e46385 100644 --- a/Source/Editor/SceneGraph/GUI/ActorTreeNode.cs +++ b/Source/Editor/SceneGraph/GUI/ActorTreeNode.cs @@ -266,7 +266,7 @@ namespace FlaxEditor.SceneGraph.GUI /// /// Starts the actor renaming action. /// - public void StartRenaming(EditorWindow window, Panel treePanel) + public void StartRenaming(EditorWindow window, Panel treePanel = null) { // Block renaming during scripts reload if (Editor.Instance.ProgressReporting.CompileScripts.IsActive) @@ -281,9 +281,12 @@ namespace FlaxEditor.SceneGraph.GUI (window as PrefabWindow).ScrollingOnTreeView(false); // Start renaming the actor - treePanel.ScrollViewTo(this, true); - var size = new Float2(treePanel.Width - TextRect.Location.X, TextRect.Height); - var rect = new Rectangle(TextRect.Location, size); + var rect = TextRect; + if (treePanel != null) + { + treePanel.ScrollViewTo(this, true); + rect.Size = new Float2(treePanel.Width - TextRect.Location.X, TextRect.Height); + } var dialog = RenamePopup.Show(this, rect, _actorNode.Name, false); dialog.Renamed += OnRenamed; dialog.Closed += popup =>