-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
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
ImGuiTreeNodeFlags: Framed flag makes Leaf/Bullet flags become ignored (unnecessarily) #2159
Comments
Yes. It's a little bit of a faff but if you can make a nice PR for it I would merge that. |
Thanks! I'll look into that, then. It would be a minimal change, but I'll have to try it out first. |
I made some tests, to see how it would look. The only change is in the Leaf and/or Bullet headers in the screenshot below. It's straight forward and matches what's already there for tree nodes, except for the "Leaf header" where I left-adjusted the text to match any unindented Text sub-/sibling items. (BTW, I noted that Leaf implies that the tree node or header is always open, so any (logically) nested sub-items are always visible. Convenient!) |
To apply the Bullet/Leaf flags I used TreeNodeEx(), since CollapsingHeader() does not accept flags. Left-adjusting the text for (non-Bullet) Leaf headers (as in my screenshot) means we are a bit less consistent with normal (non-Framed) tree nodes, but I think it looks better in the Framed context and it also aligns better with NoTreePushOnOpen (which is the default for CollapsingHeader). |
Alright, I made a pull request: #2160 |
Thank you Goran! |
…uiTreeNodeFlags_Leaf on framed nodes. (#2159, #2160) The Bullet and Leaf ImGuiTreeNodeFlags are now taken into account for Framed/CollapsingHeader tree nodes as well. TreeNodeEx() can be used to specify these flags. A choice was made to left-adjust the Framed text when no Bullet/Arrow is rendered, since this was deemed to look better in the Framed context (especially when considering that CollapsingHeader is drawn using NoTreePushOnOpen, so child/sibling Text items etc will often be non-indented).
Merged now, sorry for the late reaction! |
Version/Branch of Dear ImGui:
1.65
Back-end file/Renderer/OS:
Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
OS: Windows 10
Compiler: Visual Studio 2017 (if the question is related to building)
My Issue/Question:
Hi! I'd like to be able to render a CollapsingHeader() without an arrow or with a bullet (for use as a plain separator etc). I tried calling TreeNodeEx() and passing ImGuiTreeNodeFlags of CollapsingHeader and Leaf/Bullet, but the latter flag was ignored.
I looked at the code for ImGui::TreeNodeBehavior() and found that in the "if (display_frame)" path, RenderArrow() is called without looking at flags ImGuiTreeNodeFlags_Bullet and ImGuiTreeNodeFlags_Leaf, while the "else" path handles these as expected.
Do you think this could be changed? There doesn't seem to be many other differences between the framed and unframed cases...
Standalone, minimal, complete and verifiable example:
Screenshots/Video
The text was updated successfully, but these errors were encountered: