Skip to content

Commit 7abd41b

Browse files
committed
TabBar: fixed ScrollToBar request creating bouncing loop when tab is larger than available space.
1 parent 9fce278 commit 7abd41b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

docs/CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Other Changes:
3737
- ColorPicker: Made rendering aware of global style alpha of the picker can be faded out. (#2711)
3838
Note that some elements won't accurately fade down with the same intensity, and the color wheel
3939
when enabled will have small overlap glitches with (style.Alpha < 1.0).
40+
- TabBar: fixed ScrollToBar request creating bouncing loop when tab is larger than available space.
4041
- Backends: DX11: Fixed GSGetShader() call not passing an initialized instance count,
4142
would generally make the debug layer complain (Added in 1.72).
4243
- Backends: Vulkan: Added support for specifying multisample count.

imgui_widgets.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6638,7 +6638,7 @@ static void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
66386638
float tab_x1 = tab->Offset + (order > 0 ? -margin : 0.0f);
66396639
float tab_x2 = tab->Offset + tab->Width + (order + 1 < tab_bar->Tabs.Size ? margin : 1.0f);
66406640
tab_bar->ScrollingTargetDistToVisibility = 0.0f;
6641-
if (tab_bar->ScrollingTarget > tab_x1)
6641+
if (tab_bar->ScrollingTarget > tab_x1 || (tab_x2 - tab_x1 >= tab_bar->BarRect.GetWidth()))
66426642
{
66436643
tab_bar->ScrollingTargetDistToVisibility = ImMax(tab_bar->ScrollingAnim - tab_x2, 0.0f);
66446644
tab_bar->ScrollingTarget = tab_x1;

0 commit comments

Comments
 (0)