Columns: Fixed Separator from creating an extraneous draw command. Fixed Selectable with SpanAllColumns flag from creating an extraneous draw command. (#125)

This commit is contained in:
omar
2019-05-09 12:10:36 +02:00
parent 42fc563fed
commit b7c2759f95
4 changed files with 38 additions and 12 deletions

View File

@ -1216,7 +1216,7 @@ void ImGui::Separator()
// Horizontal Separator
if (window->DC.CurrentColumns)
PopClipRect();
PushColumnsBackground();
float x1 = window->Pos.x;
float x2 = window->Pos.x + window->Size.x;
@ -1228,7 +1228,7 @@ void ImGui::Separator()
if (!ItemAdd(bb, 0))
{
if (window->DC.CurrentColumns)
PushColumnClipRect();
PopColumnsBackground();
return;
}
@ -1239,7 +1239,7 @@ void ImGui::Separator()
if (window->DC.CurrentColumns)
{
PushColumnClipRect();
PopColumnsBackground();
window->DC.CurrentColumns->LineMinY = window->DC.CursorPos.y;
}
}
@ -5311,7 +5311,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
const ImGuiStyle& style = g.Style;
if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.CurrentColumns) // FIXME-OPT: Avoid if vertically clipped.
PopClipRect();
PushColumnsBackground();
ImGuiID id = window->GetID(label);
ImVec2 label_size = CalcTextSize(label, NULL, true);
@ -5355,7 +5355,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
if (!item_add)
{
if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.CurrentColumns)
PushColumnClipRect();
PopColumnsBackground();
return false;
}
@ -5401,7 +5401,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
if ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.CurrentColumns)
{
PushColumnClipRect();
PopColumnsBackground();
bb.Max.x -= (GetContentRegionMax().x - max_x);
}