1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 02:00:58 +01:00

BeginTabBar: Fix to push the expected ID into the ID stack (instead of a hash's hash). (#261)

This commit is contained in:
omar 2018-12-11 15:22:10 +01:00
parent 95dcc534ed
commit 5a6b8e00db

View File

@ -6218,7 +6218,10 @@ bool ImGui::BeginTabItem(const char* label, bool* p_open, ImGuiTabItemFlags f
ImGuiTabBar* tab_bar = g.CurrentTabBar.back();
bool ret = TabItemEx(tab_bar, label, p_open, flags);
if (ret && !(flags & ImGuiTabItemFlags_NoPushId))
PushID(tab_bar->Tabs[tab_bar->LastTabItemIdx].ID);
{
ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
g.CurrentWindow->IDStack.push_back(tab->ID); // We already hashed 'label' so push into the ID stack directly instead of doing another hash through PushID(label)
}
return ret;
}
@ -6232,7 +6235,7 @@ void ImGui::EndTabItem()
ImGuiTabBar* tab_bar = g.CurrentTabBar.back();
ImGuiTabItem* tab = &tab_bar->Tabs[tab_bar->LastTabItemIdx];
if (!(tab->Flags & ImGuiTabItemFlags_NoPushId))
PopID();
g.CurrentWindow->IDStack.pop_back();
}
bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, const char* label, bool* p_open, ImGuiTabItemFlags flags)