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

Commit 4009c55

Browse files
committed
Doing the same view switching logic that Window has
1 parent 684659d commit 4009c55

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,23 @@ private void OpenInternal(PopupViewType popupViewType, Action<bool> onClose)
8787
OnClose += onClose;
8888
}
8989

90+
var fromView = ActiveView;
9091
ActiveViewType = popupViewType;
91-
ActiveView.OnEnable();
92-
titleContent = new GUIContent(ActiveView.Title, Styles.SmallLogo);
92+
SwitchView(fromView, ActiveView);
9393
Show();
94-
Redraw();
94+
}
95+
96+
private void SwitchView(Subview fromView, Subview toView)
97+
{
98+
GUI.FocusControl(null);
99+
100+
if (fromView != null)
101+
fromView.OnDisable();
102+
toView.OnEnable();
103+
titleContent = new GUIContent(ActiveView.Title, Styles.SmallLogo);
104+
105+
// this triggers a repaint
106+
Repaint();
95107
}
96108

97109
public IApiClient Client

0 commit comments

Comments
 (0)