Scrollbar: tidying up (#355)

This commit is contained in:
ocornut 2015-09-30 21:19:54 +02:00
parent 5d3d136733
commit c9d51d99b4

View File

@ -4049,17 +4049,11 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal)
: ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + window->TitleBarHeight() + 0, window_rect.Max.x, window_rect.Max.y - 0 - other_scrollbar_size_w); : ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + window->TitleBarHeight() + 0, window_rect.Max.x, window_rect.Max.y - 0 - other_scrollbar_size_w);
float window_rounding = (window->Flags & ImGuiWindowFlags_ChildWindow) ? style.ChildWindowRounding : style.WindowRounding; float window_rounding = (window->Flags & ImGuiWindowFlags_ChildWindow) ? style.ChildWindowRounding : style.WindowRounding;
int window_rounding_corners = 0; int window_rounding_corners;
if (horizontal) if (horizontal)
{ window_rounding_corners = 8 | (other_scrollbar ? 0 : 4);
if (!other_scrollbar) window_rounding_corners |= 4;
window_rounding_corners |= 8;
}
else else
{ window_rounding_corners = ((window->Flags & ImGuiWindowFlags_NoTitleBar) ? 2 : 0) | (other_scrollbar ? 0 : 4);
if (window->Flags & ImGuiWindowFlags_NoTitleBar) window_rounding_corners |= 2;
if (!other_scrollbar) window_rounding_corners |= 4;
}
window->DrawList->AddRectFilled(bb.Min, bb.Max, window->Color(ImGuiCol_ScrollbarBg), window_rounding, window_rounding_corners); window->DrawList->AddRectFilled(bb.Min, bb.Max, window->Color(ImGuiCol_ScrollbarBg), window_rounding, window_rounding_corners);
bb.Expand(-3.0f); bb.Expand(-3.0f);