mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-23 04:17:00 +00:00
Clipper: simplify code and remove cases where true is returned with empty display range as an extra step.
This commit is contained in:
parent
07b9999de9
commit
72096bf698
10
imgui.cpp
10
imgui.cpp
@ -2669,9 +2669,8 @@ static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper)
|
|||||||
if (data->StepNo == 0 && table != NULL && !table->IsUnfrozenRows)
|
if (data->StepNo == 0 && table != NULL && !table->IsUnfrozenRows)
|
||||||
{
|
{
|
||||||
clipper->DisplayStart = data->ItemsFrozen;
|
clipper->DisplayStart = data->ItemsFrozen;
|
||||||
clipper->DisplayEnd = data->ItemsFrozen + 1;
|
clipper->DisplayEnd = ImMin(data->ItemsFrozen + 1, clipper->ItemsCount);
|
||||||
if (clipper->DisplayStart >= clipper->ItemsCount)
|
if (clipper->DisplayStart < clipper->DisplayEnd)
|
||||||
return false;
|
|
||||||
data->ItemsFrozen++;
|
data->ItemsFrozen++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2687,8 +2686,6 @@ static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper)
|
|||||||
data->Ranges.push_front(ImGuiListClipperRange::FromIndices(data->ItemsFrozen, data->ItemsFrozen + 1));
|
data->Ranges.push_front(ImGuiListClipperRange::FromIndices(data->ItemsFrozen, data->ItemsFrozen + 1));
|
||||||
clipper->DisplayStart = ImMax(data->Ranges[0].Min, data->ItemsFrozen);
|
clipper->DisplayStart = ImMax(data->Ranges[0].Min, data->ItemsFrozen);
|
||||||
clipper->DisplayEnd = ImMin(data->Ranges[0].Max, clipper->ItemsCount);
|
clipper->DisplayEnd = ImMin(data->Ranges[0].Max, clipper->ItemsCount);
|
||||||
if (clipper->DisplayStart == clipper->DisplayEnd)
|
|
||||||
return false;
|
|
||||||
data->StepNo = 1;
|
data->StepNo = 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2778,9 +2775,10 @@ static bool ImGuiListClipper_StepInternal(ImGuiListClipper* clipper)
|
|||||||
bool ImGuiListClipper::Step()
|
bool ImGuiListClipper::Step()
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
|
||||||
bool need_items_height = (ItemsHeight <= 0.0f);
|
bool need_items_height = (ItemsHeight <= 0.0f);
|
||||||
bool ret = ImGuiListClipper_StepInternal(this);
|
bool ret = ImGuiListClipper_StepInternal(this);
|
||||||
|
if (ret && (DisplayStart == DisplayEnd))
|
||||||
|
ret = false;
|
||||||
if (g.CurrentTable && g.CurrentTable->IsUnfrozenRows == false)
|
if (g.CurrentTable && g.CurrentTable->IsUnfrozenRows == false)
|
||||||
IMGUI_DEBUG_LOG_CLIPPER("Clipper: Step(): inside frozen table row.\n");
|
IMGUI_DEBUG_LOG_CLIPPER("Clipper: Step(): inside frozen table row.\n");
|
||||||
if (need_items_height && ItemsHeight > 0.0f)
|
if (need_items_height && ItemsHeight > 0.0f)
|
||||||
|
Loading…
Reference in New Issue
Block a user