Skip to content

Commit

Permalink
fixed ProgressBar scrolling behaviour (#6175)
Browse files Browse the repository at this point in the history
  • Loading branch information
cansik authored Oct 6, 2023
1 parent 6cd52c8 commit ce442ea
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cpp/open3d/visualization/gui/ProgressBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ce442ea

Please sign in to comment.