mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 21:59:02 +08:00
Scrollbar: Minor graphical fix for when scrollbar don't have enough visible space to display the full grab.
This commit is contained in:
parent
f5bdf443c9
commit
9b82d9fbef
@ -4782,10 +4782,12 @@ void ImGui::Scrollbar(ImGuiLayoutType direction)
|
||||
|
||||
// Render
|
||||
const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab);
|
||||
ImRect grab_rect;
|
||||
if (horizontal)
|
||||
window->DrawList->AddRectFilled(ImVec2(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y), ImVec2(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, bb.Max.y), grab_col, style.ScrollbarRounding);
|
||||
grab_rect = ImRect(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y, ImMin(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, window_rect.Max.x), bb.Max.y);
|
||||
else
|
||||
window->DrawList->AddRectFilled(ImVec2(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm)), ImVec2(bb.Max.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels), grab_col, style.ScrollbarRounding);
|
||||
grab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImMin(ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels, window_rect.Max.y));
|
||||
window->DrawList->AddRectFilled(grab_rect.Min, grab_rect.Max, grab_col, style.ScrollbarRounding);
|
||||
}
|
||||
|
||||
// Moving window to front of display (which happens to be back of our sorted list)
|
||||
|
Loading…
Reference in New Issue
Block a user