mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-28 01:20:55 +01:00
Tab Bar: Fixed a small bug where closing a tab that is not selected would leave a tab hole for a frame.
This commit is contained in:
parent
795cf6fcb5
commit
afc1099fb5
@ -81,6 +81,7 @@ Other Changes:
|
|||||||
and amends the change done in 1.76 which only affected cases were _OpenOnArrow flag was set.
|
and amends the change done in 1.76 which only affected cases were _OpenOnArrow flag was set.
|
||||||
(This is also necessary to support full multi/range-select/drag and drop operations.)
|
(This is also necessary to support full multi/range-select/drag and drop operations.)
|
||||||
- Tab Bar: Keep tab item close button visible while dragging a tab (independent of hovering state).
|
- Tab Bar: Keep tab item close button visible while dragging a tab (independent of hovering state).
|
||||||
|
- Tab Bar: Fixed a small bug where closing a tab that is not selected would leave a tab hole for a frame.
|
||||||
- Tab Bar: Fixed a small bug where toggling a tab bar from Reorderable to not Reorderable would leave
|
- 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. [@Xipiryon]
|
tabs reordered in the tab list popup. [@Xipiryon]
|
||||||
- Columns: Fix inverted ClipRect being passed to renderer when using certain primitives inside of
|
- Columns: Fix inverted ClipRect being passed to renderer when using certain primitives inside of
|
||||||
|
@ -7148,17 +7148,22 @@ void ImGui::TabBarRemoveTab(ImGuiTabBar* tab_bar, ImGuiID tab_id)
|
|||||||
// Called on manual closure attempt
|
// Called on manual closure attempt
|
||||||
void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
|
void ImGui::TabBarCloseTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
|
||||||
{
|
{
|
||||||
if ((tab_bar->VisibleTabId == tab->ID) && !(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
if (!(tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
||||||
{
|
{
|
||||||
// This will remove a frame of lag for selecting another tab on closure.
|
// This will remove a frame of lag for selecting another tab on closure.
|
||||||
// However we don't run it in the case where the 'Unsaved' flag is set, so user gets a chance to fully undo the closure
|
// However we don't run it in the case where the 'Unsaved' flag is set, so user gets a chance to fully undo the closure
|
||||||
tab->LastFrameVisible = -1;
|
tab->WantClose = true;
|
||||||
tab_bar->SelectedTabId = tab_bar->NextSelectedTabId = 0;
|
if (tab_bar->VisibleTabId == tab->ID)
|
||||||
|
{
|
||||||
|
tab->LastFrameVisible = -1;
|
||||||
|
tab_bar->SelectedTabId = tab_bar->NextSelectedTabId = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ((tab_bar->VisibleTabId != tab->ID) && (tab->Flags & ImGuiTabItemFlags_UnsavedDocument))
|
else
|
||||||
{
|
{
|
||||||
// Actually select before expecting closure
|
// Actually select before expecting closure attempt (on an UnsavedDocument tab user is expect to e.g. show a popup)
|
||||||
tab_bar->NextSelectedTabId = tab->ID;
|
if (tab_bar->VisibleTabId != tab->ID)
|
||||||
|
tab_bar->NextSelectedTabId = tab->ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user