mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-18 08:51:06 +08:00
TabBar: fixed ScrollToBar request creating bouncing loop when tab is larger than available space.
This commit is contained in:
parent
9fce278918
commit
7abd41bd5f
@ -37,6 +37,7 @@ Other Changes:
|
||||
- ColorPicker: Made rendering aware of global style alpha of the picker can be faded out. (#2711)
|
||||
Note that some elements won't accurately fade down with the same intensity, and the color wheel
|
||||
when enabled will have small overlap glitches with (style.Alpha < 1.0).
|
||||
- TabBar: fixed ScrollToBar request creating bouncing loop when tab is larger than available space.
|
||||
- Backends: DX11: Fixed GSGetShader() call not passing an initialized instance count,
|
||||
would generally make the debug layer complain (Added in 1.72).
|
||||
- Backends: Vulkan: Added support for specifying multisample count.
|
||||
|
@ -6638,7 +6638,7 @@ static void ImGui::TabBarScrollToTab(ImGuiTabBar* tab_bar, ImGuiTabItem* tab)
|
||||
float tab_x1 = tab->Offset + (order > 0 ? -margin : 0.0f);
|
||||
float tab_x2 = tab->Offset + tab->Width + (order + 1 < tab_bar->Tabs.Size ? margin : 1.0f);
|
||||
tab_bar->ScrollingTargetDistToVisibility = 0.0f;
|
||||
if (tab_bar->ScrollingTarget > tab_x1)
|
||||
if (tab_bar->ScrollingTarget > tab_x1 || (tab_x2 - tab_x1 >= tab_bar->BarRect.GetWidth()))
|
||||
{
|
||||
tab_bar->ScrollingTargetDistToVisibility = ImMax(tab_bar->ScrollingAnim - tab_x2, 0.0f);
|
||||
tab_bar->ScrollingTarget = tab_x1;
|
||||
|
Loading…
Reference in New Issue
Block a user