1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-12-01 02:37:24 +01:00

Scrollbar: Minor simplication of the code using InnerRect data.

This commit is contained in:
omar 2017-12-10 17:27:37 +01:00
parent a9b01600ac
commit 7ac1583411

View File

@ -4994,10 +4994,8 @@ void ImGui::Scrollbar(ImGuiLayoutType direction)
const ImRect window_rect = window->Rect(); const ImRect window_rect = window->Rect();
const float border_size = window->WindowBorderSize; const float border_size = window->WindowBorderSize;
ImRect bb = horizontal ImRect bb = horizontal
? ImRect(window->Pos.x + border_size, window_rect.Max.y - style.ScrollbarSize, window_rect.Max.x - other_scrollbar_size_w - border_size, window_rect.Max.y - border_size) ? ImRect(window->InnerRect.Min.x, window_rect.Max.y - style.ScrollbarSize, window->InnerRect.Max.x, window_rect.Max.y - border_size)
: ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + border_size, window_rect.Max.x - border_size, window_rect.Max.y - other_scrollbar_size_w - border_size); : ImRect(window_rect.Max.x - style.ScrollbarSize, window->InnerRect.Min.y, window_rect.Max.x - border_size, window->InnerRect.Max.y);
if (!horizontal)
bb.Min.y += window->TitleBarHeight() + ((window->Flags & ImGuiWindowFlags_MenuBar) ? window->MenuBarHeight() : 0.0f);
if (bb.GetWidth() <= 0.0f || bb.GetHeight() <= 0.0f) if (bb.GetWidth() <= 0.0f || bb.GetHeight() <= 0.0f)
return; return;