diff --git a/Source/Editor/Content/Tree/ContentTreeNode.cs b/Source/Editor/Content/Tree/ContentTreeNode.cs index 2503cde51..1d70a8252 100644 --- a/Source/Editor/Content/Tree/ContentTreeNode.cs +++ b/Source/Editor/Content/Tree/ContentTreeNode.cs @@ -95,11 +95,19 @@ namespace FlaxEditor.Content { if (!_folder.CanRename) return; - + Editor.Instance.Windows.ContentWin.ScrollingOnTreeView(false); // Start renaming the folder var dialog = RenamePopup.Show(this, HeaderRect, _folder.ShortName, false); dialog.Tag = _folder; - dialog.Renamed += popup => Editor.Instance.Windows.ContentWin.Rename((ContentFolder)popup.Tag, popup.Text); + dialog.Renamed += popup => + { + Editor.Instance.Windows.ContentWin.Rename((ContentFolder)popup.Tag, popup.Text); + Editor.Instance.Windows.ContentWin.ScrollingOnTreeView(true); + }; + dialog.Closed += popup => + { + Editor.Instance.Windows.ContentWin.ScrollingOnTreeView(true); + }; } /// diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs index 56681296e..90cd77d11 100644 --- a/Source/Editor/Windows/ContentWindow.cs +++ b/Source/Editor/Windows/ContentWindow.cs @@ -292,6 +292,30 @@ namespace FlaxEditor.Windows RefreshView(SelectedNode); } + /// + /// Enables or disables vertical and horizontal scrolling on the content tree panel + /// + /// The state to set scrolling to + public void ScrollingOnTreeView(bool enabled) + { + if (_contentTreePanel.VScrollBar != null) + _contentTreePanel.VScrollBar.ThumbEnabled = enabled; + if (_contentTreePanel.HScrollBar != null) + _contentTreePanel.HScrollBar.ThumbEnabled = enabled; + } + + /// + /// Enables or disables vertical and horizontal scrolling on the content view panel + /// + /// The state to set scrolling to + public void ScrollingOnContentView(bool enabled) + { + if (_contentViewPanel.VScrollBar != null) + _contentViewPanel.VScrollBar.ThumbEnabled = enabled; + if (_contentViewPanel.HScrollBar != null) + _contentViewPanel.HScrollBar.ThumbEnabled = enabled; + } + /// /// Shows popup dialog with UI to rename content item. /// @@ -306,14 +330,7 @@ namespace FlaxEditor.Windows _split.Panel2.VScrollBar.ThumbEnabled = false; if (_split.Panel2.HScrollBar != null) _split.Panel2.HScrollBar.ThumbEnabled = false; - if (_contentViewPanel.VScrollBar != null) - _contentViewPanel.VScrollBar.ThumbEnabled = false; - if (_contentViewPanel.HScrollBar != null) - _contentViewPanel.HScrollBar.ThumbEnabled = false; - if (_contentTreePanel.VScrollBar != null) - _contentTreePanel.VScrollBar.ThumbEnabled = false; - if (_contentTreePanel.HScrollBar != null) - _contentTreePanel.HScrollBar.ThumbEnabled = false; + ScrollingOnContentView(false); // Show rename popup var popup = RenamePopup.Show(item, item.TextRectangle, item.ShortName, true); @@ -327,14 +344,7 @@ namespace FlaxEditor.Windows _split.Panel2.VScrollBar.ThumbEnabled = true; if (_split.Panel2.HScrollBar != null) _split.Panel2.HScrollBar.ThumbEnabled = true; - if (_contentViewPanel.VScrollBar != null) - _contentViewPanel.VScrollBar.ThumbEnabled = true; - if (_contentViewPanel.HScrollBar != null) - _contentViewPanel.HScrollBar.ThumbEnabled = true; - if (_contentTreePanel.VScrollBar != null) - _contentTreePanel.VScrollBar.ThumbEnabled = true; - if (_contentTreePanel.HScrollBar != null) - _contentTreePanel.HScrollBar.ThumbEnabled = true; + ScrollingOnContentView(true); // Check if was creating new element if (_newElement != null)