ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
58.4k stars 10.01k forks source link

Bug fix in ImGui::MenuItemEx #5149

Open danbrown3 opened 2 years ago

danbrown3 commented 2 years ago

I'm not set up with a branch, so I can't do a pull request, but I have a two line fix that you might want to take. In ImGui::MenuItemEx, the size calculation does not account for a scrollbar. This means that if a scrollbar is present, it covers up whatever is on the right side. I made the following change to fix it.

    float scrollbar_w = window->ScrollbarY ? window->ScrollbarSizes.x : 0.0f;
    float stretch_w = ImMax(0.0f, GetContentRegionAvail().x - min_w - scrollbar_w);
ocornut commented 2 years ago

It looks correct if I try in the demo (by resizing the host platform window down to force a vertical scrollbar):

image

Please provide a repro and more details. The issue template is here for a reason.

ocornut commented 2 years ago

You can also see in Metrics->Tools that the ContentRegionRect is altered by the presence of a scrollbar. image

In the absence of a version number, a repro, a screenshot or anything requested by the issue template I am closing it. Please provide evidence and details so we can look at this. Thank you!

danbrown3 commented 2 years ago

Sorry, my bad. I should have realized this would be treated as a bug. Version is 1.85, I believe. For confidentiality reasons, I can't give you a screenshot of the menu, but here is the code:

Capture

The result of this is that the check mark for the menu item is rendered under the scrollbar.

ocornut commented 1 year ago

An actual pastable repro would be welcome. Above in my screenshot are evidence that it works in the general case. I don’t doubt that there may be a bug but if I can neither see it neither repro it things are going to be difficult.

From the structure you pasted (in a screenshot) if you were to unroll it with actual data you could either create a repro either begin to understand which parameters are causing the issue. Right now I am missing most of the data for a repro.

Out of experience, 90%+ of issues are more complex than what they look like, and again I provided evidence that contradicts your statement so we need details to proceed.