Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit d47246d

Browse files
Changing where the tabs get swtiched; Inlining some methods for clarity
1 parent f9bd4fc commit d47246d

File tree

1 file changed

+15
-28
lines changed
  • src/UnityExtension/Assets/Editor/GitHub.Unity/UI

1 file changed

+15
-28
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/Window.cs

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,21 @@ public override void OnDataUpdate()
120120
}
121121
}
122122

123+
if (nextTab != activeTab)
124+
{
125+
var fromView = ActiveView;
126+
activeTab = nextTab;
127+
128+
GUI.FocusControl(null);
129+
130+
if (fromView != null)
131+
fromView.OnDisable();
132+
133+
ActiveView.OnEnable();
134+
135+
Refresh();
136+
}
137+
123138
if (ActiveView != null)
124139
ActiveView.OnDataUpdate();
125140
}
@@ -161,12 +176,6 @@ public override void OnUI()
161176

162177
DoToolbarGUI();
163178

164-
if (nextTab != activeTab)
165-
{
166-
SetActiveTab(nextTab);
167-
nextTab = activeTab;
168-
}
169-
170179
// GUI for the active tab
171180
if (ActiveView != null)
172181
{
@@ -323,28 +332,6 @@ private void DoToolbarGUI()
323332
EditorGUILayout.EndHorizontal();
324333
}
325334

326-
private void SetActiveTab(SubTab changeTab)
327-
{
328-
if (changeTab != activeTab)
329-
{
330-
var fromView = ActiveView;
331-
activeTab = changeTab;
332-
SwitchView(fromView, ActiveView);
333-
}
334-
}
335-
336-
private void SwitchView(Subview fromView, Subview toView)
337-
{
338-
GUI.FocusControl(null);
339-
340-
if (fromView != null)
341-
fromView.OnDisable();
342-
343-
toView.OnEnable();
344-
345-
Refresh();
346-
}
347-
348335
private void DoAccountDropdown()
349336
{
350337
GenericMenu accountMenu = new GenericMenu();

0 commit comments

Comments
 (0)