Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProgressBar draws 'progress' even when value is 0 #1296

Closed
berkay2578 opened this issue Aug 25, 2017 · 5 comments
Closed

ProgressBar draws 'progress' even when value is 0 #1296

berkay2578 opened this issue Aug 25, 2017 · 5 comments

Comments

@berkay2578
Copy link

berkay2578 commented Aug 25, 2017

Before all, I'm running version 1.51. ProgressBar draws an unexpected filled rectangle when the fraction value is 0 and style.FrameRounding is greater than 0.0f. This also happens with the default theme. I tried to fix it but I failed.

With FrameRounding:
image
Without FrameRounding:
image2

gifs:
style.FrameRounding = 0.0f
style.FrameRounding > 0.0f

A dirty workaround for now is to use:
RenderFrame(bb.Min, fill_br, GetColorU32(ImGuiCol_PlotHistogram), false, fraction < 0.01f ? 0.0f : style.FrameRounding);

@berkay2578 berkay2578 changed the title ProgressBar draws when value is 0 ProgressBar draws 'progress' even when value is 0 Aug 25, 2017
@berkay2578
Copy link
Author

berkay2578 commented Aug 26, 2017

I have also noticed that the rectangle of ImGuiCol_PlotHistogram is drawn over the rectangle of ImGuiCol_FrameBg, this causes issues if you want both of the colours to have transparency. off-topic.

@ocornut
Copy link
Owner

ocornut commented Aug 27, 2017

I have also noticed that the rectangle of ImGuiCol_PlotHistogram is drawn over the rectangle of ImGuiCol_FrameBg, this causes issues if you want both of the colours to have transparency.

Most things in imgui are drawn over the FrameBg color, that's the desired platforms. Your solution wouldn't easily be applicable to widgets like PlotHistogram(), etc.

I'll look at how we can fix your first issue above.

(sorry about the gfycat links)

Please use github attachment and no external link when possible, else the links will end up failing in the future, making things harder to refer to for others.

@berkay2578
Copy link
Author

berkay2578 commented Aug 27, 2017

Most things in imgui are drawn over the FrameBg color, that's the desired platforms. Your solution wouldn't easily be applicable to widgets like PlotHistogram(), etc.

Yeah, I know, it's for extreme situations like mine where I'm using it to draw a digital speedometer with the RPM value as the background. I'll just remove the code since it's off-topic.

Please use github attachment and no external link when possible, else the links will end up failing in the future, making things harder to refer to for others.

Noted, I've edited the main post to have images of the issue.

@ocornut
Copy link
Owner

ocornut commented Aug 28, 2017

Yeah, I know, it's for extreme situations like mine where I'm using it to draw a digital speedometer with the RPM value as the background.

That function is literally 2 calls to RenderFrame() which is 1 call to draw_list->AddRectFilled(), if you are doing custom rendering you'd probably be better just doing the calls yourself instead of relying on ProgressBar.

Looking at the rendering.

ocornut added a commit that referenced this issue Aug 29, 2017
…s bar, which will also help for range widgets and perhaps sliders grabs over rounded areas. (#1296, #76)
@ocornut
Copy link
Owner

ocornut commented Aug 29, 2017

This should be fixed now (with quite some pain to get the rendering right - but the resulting function will be useful for other stuff).

@ocornut ocornut closed this as completed Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants