Return scrollbar rectangle, must only be called for corresponding axis if window->ScrollbarX/Y is set.
| 971 | |
| 972 | // Return scrollbar rectangle, must only be called for corresponding axis if window->ScrollbarX/Y is set. |
| 973 | ImRect ImGui::GetWindowScrollbarRect(ImGuiWindow* window, ImGuiAxis axis) |
| 974 | { |
| 975 | ImGuiContext& g = *GImGui; |
| 976 | const ImRect outer_rect = window->Rect(); |
| 977 | const ImRect inner_rect = window->InnerRect; |
| 978 | const float scrollbar_size = window->ScrollbarSizes[axis ^ 1]; // (ScrollbarSizes.x = width of Y scrollbar; ScrollbarSizes.y = height of X scrollbar) |
| 979 | IM_ASSERT(scrollbar_size >= 0.0f); |
| 980 | const float border_size = IM_ROUND(window->WindowBorderSize * 0.5f); |
| 981 | const float border_top = (window->Flags & ImGuiWindowFlags_MenuBar) ? IM_ROUND(g.Style.FrameBorderSize * 0.5f) : (window->Flags & ImGuiWindowFlags_NoTitleBar) ? border_size : 0; |
| 982 | if (axis == ImGuiAxis_X) |
| 983 | return ImRect(inner_rect.Min.x + border_size, ImMax(outer_rect.Min.y + border_size, outer_rect.Max.y - border_size - scrollbar_size), inner_rect.Max.x - border_size, outer_rect.Max.y - border_size); |
| 984 | else |
| 985 | return ImRect(ImMax(outer_rect.Min.x, outer_rect.Max.x - border_size - scrollbar_size), inner_rect.Min.y + border_top, outer_rect.Max.x - border_size, inner_rect.Max.y - border_size); |
| 986 | } |
| 987 | |
| 988 | void ImGui::ExtendHitBoxWhenNearViewportEdge(ImGuiWindow* window, ImRect* bb, float threshold, ImGuiAxis axis) |
| 989 | { |