You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many times using the clipper helper I thought that it needed to be improved. Since the requirement of passing item height manually is rather error-prone.
ImGuiListClipper clipper(lines, ImGui::GetTextLineHeightWithSpacing());
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
ImGui::Text("%i The quick brown fox jumps over the lazy dog\n", i);
clipper.End();
And improved version could be:
ImGuiListClipper clipper(lines);
while (clipper.Step())
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
ImGui::Text("%i The quick brown fox jumps over the lazy dog\n", i);
(unsure about Step function name - any suggestion?)
The idea is that:
The first time Step() function is called would return true, set DisplayStart to 0 and DisplayEnd to 1
This first loop would be used to calculate the item height
The second time Step() function is called it would return true, set DisplayStart/DisplayEnd to actual values based on clipping.
The third time Step() function is called it would return false and call "End" which is the final positional seeking.
Interesting this improvement seems possible without breaking the current code.
I would make the second parameter of the construction -1 by default.
The text was updated successfully, but these errors were encountered:
Many times using the clipper helper I thought that it needed to be improved. Since the requirement of passing item height manually is rather error-prone.
Also issues e.g. #660
Currently typically use is:
And improved version could be:
(unsure about
Step
function name - any suggestion?)The idea is that:
Interesting this improvement seems possible without breaking the current code.
I would make the second parameter of the construction -1 by default.
The text was updated successfully, but these errors were encountered: