mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-01 10:47:24 +01:00
ImGuiListClipper: fixed automatic-height calc path dumbly having user display element 0 twice (#661, #716)
First bug out of two. Was easily visible using e.g. 50% alpha text.
This commit is contained in:
parent
297bb3fc92
commit
74bbfcfaa6
@ -1680,8 +1680,9 @@ bool ImGuiListClipper::Step()
|
|||||||
if (ItemsCount == 1) { ItemsCount = -1; return false; }
|
if (ItemsCount == 1) { ItemsCount = -1; return false; }
|
||||||
float items_height = ImGui::GetCursorPosY() - StartPosY;
|
float items_height = ImGui::GetCursorPosY() - StartPosY;
|
||||||
IM_ASSERT(items_height > 0.0f); // If this triggers, it means Item 0 hasn't moved the cursor vertically
|
IM_ASSERT(items_height > 0.0f); // If this triggers, it means Item 0 hasn't moved the cursor vertically
|
||||||
ImGui::SetCursorPosY(StartPosY); // Rewind cursor so we can Begin() again, this time with a known height.
|
Begin(ItemsCount-1, items_height);
|
||||||
Begin(ItemsCount, items_height);
|
DisplayStart++;
|
||||||
|
DisplayEnd++;
|
||||||
StepNo = 3;
|
StepNo = 3;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user