From ce442eaef4521f73c11c9e451c5b2da835f4f712 Mon Sep 17 00:00:00 2001 From: Florian Bruggisser Date: Fri, 6 Oct 2023 22:43:50 +0200 Subject: [PATCH] fixed ProgressBar scrolling behaviour (#6175) --- cpp/open3d/visualization/gui/ProgressBar.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cpp/open3d/visualization/gui/ProgressBar.cpp b/cpp/open3d/visualization/gui/ProgressBar.cpp index a55e32bb090..0c930155a41 100644 --- a/cpp/open3d/visualization/gui/ProgressBar.cpp +++ b/cpp/open3d/visualization/gui/ProgressBar.cpp @@ -42,16 +42,19 @@ Widget::DrawResult ProgressBar::Draw(const DrawContext& context) { auto fg = context.theme.border_color; auto color = colorToImguiRGBA(fg); float rounding = frame.height / 2.0f; + ImGui::GetWindowDrawList()->AddRect( - ImVec2(float(frame.x), float(frame.y)), - ImVec2(float(frame.GetRight()), float(frame.GetBottom())), color, - rounding); + ImVec2(float(frame.x), float(frame.y) - ImGui::GetScrollY()), + ImVec2(float(frame.GetRight()), + float(frame.GetBottom()) - ImGui::GetScrollY()), + color, rounding); float x = float(frame.x) + float(frame.width) * impl_->value_; x = std::max(x, float(frame.x + rounding)); + ImGui::GetWindowDrawList()->AddRectFilled( - ImVec2(float(frame.x), float(frame.y)), - ImVec2(float(x), float(frame.GetBottom())), color, - frame.height / 2.0f); + ImVec2(float(frame.x), float(frame.y) - ImGui::GetScrollY()), + ImVec2(float(x), float(frame.GetBottom()) - ImGui::GetScrollY()), + color, frame.height / 2.0f); return DrawResult::NONE; }