Tab Bar: Fixed a small bug where toggling a tab bar from Reorderable to not Reorderable would leave tabs reordered in the tab list popup.

This commit is contained in:
Louis Schnellbach
2020-08-26 12:18:02 +02:00
committed by ocornut
parent b30d33378d
commit 8c80d533d9
3 changed files with 14 additions and 8 deletions

View File

@ -1710,9 +1710,10 @@ struct ImGuiTabItem
float Width; // Width currently displayed
float ContentWidth; // Width of actual contents, stored during BeginTabItem() call
ImS16 NameOffset; // When Window==NULL, offset to name within parent ImGuiTabBar::TabsNames
ImS8 BeginOrder; // BeginTabItem() order, used to re-order tabs after toggling ImGuiTabBarFlags_Reorderable
bool WantClose; // Marked as closed by SetTabItemClosed()
ImGuiTabItem() { ID = 0; Flags = ImGuiTabItemFlags_None; LastFrameVisible = LastFrameSelected = -1; NameOffset = -1; Offset = Width = ContentWidth = 0.0f; WantClose = false; }
ImGuiTabItem() { ID = 0; Flags = ImGuiTabItemFlags_None; LastFrameVisible = LastFrameSelected = -1; NameOffset = -1; Offset = Width = ContentWidth = 0.0f; BeginOrder = -1; WantClose = false; }
};
// Storage for a tab bar (sizeof() 92~96 bytes)
@ -1737,9 +1738,10 @@ struct ImGuiTabBar
ImGuiTabBarFlags Flags;
ImGuiID ReorderRequestTabId;
ImS8 ReorderRequestDir;
ImS8 TabsActiveCount; // Number of tabs submitted this frame.
bool WantLayout;
bool VisibleTabWasSubmitted;
short LastTabItemIdx; // For BeginTabItem()/EndTabItem()
short LastTabItemIdx; // Index of last BeginTabItem() tab for use by EndTabItem()
ImVec2 FramePadding; // style.FramePadding locked at the time of BeginTabBar()
ImGuiTextBuffer TabsNames; // For non-docking tab bar we re-append names in a contiguous buffer.