From edc1190a403b024cfd751e295a7be617bb508b4b Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Wed, 15 Apr 2026 14:58:21 +0800 Subject: [PATCH] fix --- .../DragonDocs/Editors/DragonDocsWindow.cs | 41 +++++++++++++++---- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/Tools/DragonDocs/Editors/DragonDocsWindow.cs b/src/Tools/DragonDocs/Editors/DragonDocsWindow.cs index 6a53dcc..4c93499 100644 --- a/src/Tools/DragonDocs/Editors/DragonDocsWindow.cs +++ b/src/Tools/DragonDocs/Editors/DragonDocsWindow.cs @@ -70,12 +70,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors moveSign = -1; } } - _selectedIndex += moveSign; - if(moveSign != 0) - { - Repaint(); - return; - } + // _selectedIndex += moveSign; DragonDocs docs = DragonDocsPrefs.instance.Docs; if (docs == null || docs.Metas.IsEmpty) @@ -106,7 +101,7 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors MetaGroupInfo selectedGroupInfo; using (DragonGUI.Layout.BeginScrollView(ref ButtonsScrolPosition, UnityEditorUtility.GetClearBackgrounStyle(), GUILayout.Width(_buttonsWidth))) { - selectedGroupInfo = DrawGroups(); + selectedGroupInfo = DrawGroups(moveSign); } DrawDragger(); @@ -134,6 +129,12 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors { GUILayout.Label(infos[_selectedIndex].Path); } + + if (moveSign != 0) + { + Repaint(); + return; + } } private void DrawToolbar() @@ -345,13 +346,16 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors } } - private MetaGroupInfo DrawGroups() + private MetaGroupInfo DrawGroups(int moveSign) { Event current = Event.current; MetaGroupInfo result = new MetaGroupInfo("NO_NAME", "NO_NAME", 0, 0, 0); var infos = Prefs.Infos; var isExpands = Prefs.IsExpands; + int prevIndex = 0; + int nextIndex = 0; + using (DragonGUI.SetIndentLevel(0)) { int clippingDepth = int.MaxValue; @@ -379,6 +383,15 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors { clippingDepth = int.MaxValue; } + if(nextIndex < _selectedIndex) + { + prevIndex = nextIndex; + } + if (nextIndex <= _selectedIndex) + { + nextIndex = i; + } + if (_searchingSample.Length == 0) { @@ -447,6 +460,18 @@ namespace DCFApixels.DragonECS.Unity.Docs.Editors } } } + + if(moveSign != 0) + { + if(moveSign < 0) + { + _selectedIndex = prevIndex; + } + else + { + _selectedIndex = nextIndex; + } + } return result; }