Fixed pushes to imgui styles so its contained to only admin panel.

This commit is contained in:
cake
2025-12-11 05:38:35 +01:00
parent 6cf0e3daed
commit 1b2db4c698

View File

@@ -454,52 +454,63 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
var style = ImGui.GetStyle();
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(10f, 5f) * ImGuiHelpers.GlobalScale);
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(8f, style.ItemSpacing.Y));
ImGui.PushStyleVar(ImGuiStyleVar.TabRounding, 5f * ImGuiHelpers.GlobalScale);
var baseTab = UIColors.Get("FullBlack").WithAlpha(0.0f);
var baseTabDim = UIColors.Get("FullBlack").WithAlpha(0.1f);
var accent = UIColors.Get("LightlessPurple");
var accentHover = accent.WithAlpha(0.90f);
var accentActive = accent;
ImGui.PushStyleColor(ImGuiCol.Tab, baseTab);
ImGui.PushStyleColor(ImGuiCol.TabHovered, accentHover);
ImGui.PushStyleColor(ImGuiCol.TabActive, accentActive);
ImGui.PushStyleColor(ImGuiCol.TabUnfocused, baseTabDim);
ImGui.PushStyleColor(ImGuiCol.TabUnfocusedActive, accentActive.WithAlpha(0.80f));
//Pushing style vars for inner tab bar
ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, new Vector2(10f, 5f) * ImGuiHelpers.GlobalScale);
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(8f, style.ItemSpacing.Y));
ImGui.PushStyleVar(ImGuiStyleVar.TabRounding, 5f * ImGuiHelpers.GlobalScale);
using (var innerTabBar = ImRaii.TabBar("user_mgmt_inner_tab_" + GroupFullInfo.GID))
try
{
if (innerTabBar)
//Pushing color stack for inner tab bar
using (ImRaii.PushColor(ImGuiCol.Tab, baseTab))
using (ImRaii.PushColor(ImGuiCol.TabHovered, accentHover))
using (ImRaii.PushColor(ImGuiCol.TabActive, accentActive))
using (ImRaii.PushColor(ImGuiCol.TabUnfocused, baseTabDim))
using (ImRaii.PushColor(ImGuiCol.TabUnfocusedActive, accentActive.WithAlpha(0.80f)))
{
// Users tab
var usersTab = ImRaii.TabItem("Users");
if (usersTab)
using (var innerTabBar = ImRaii.TabBar("syncshell_tab_" + GroupFullInfo.GID))
{
DrawUserListSection();
}
usersTab.Dispose();
if (innerTabBar)
{
// Users tab
var usersTab = ImRaii.TabItem("Users");
if (usersTab)
{
DrawUserListSection();
}
usersTab.Dispose();
// Cleanup tab
var cleanupTab = ImRaii.TabItem("Cleanup");
if (cleanupTab)
{
DrawMassCleanupSection();
}
cleanupTab.Dispose();
// Cleanup tab
var cleanupTab = ImRaii.TabItem("Cleanup");
if (cleanupTab)
{
DrawMassCleanupSection();
}
cleanupTab.Dispose();
// Bans tab
var bansTab = ImRaii.TabItem("Bans");
if (bansTab)
{
DrawUserBansSection();
// Bans tab
var bansTab = ImRaii.TabItem("Bans");
if (bansTab)
{
DrawUserBansSection();
}
bansTab.Dispose();
}
}
bansTab.Dispose();
}
mgmtTab.Dispose();
}
finally
{
// Popping style vars (3) for inner tab bar
ImGui.PopStyleVar(3);
}
mgmtTab.Dispose();
}
private void DrawUserListSection()