-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Make SeparatorText[Ex] aware ImGui::SetNextItemWidth #7255
Comments
I would prefer to move forward with APIs to alter window’s WorkRect, maybe the node editor can alter WorkRect.Max.x and ContentsRect.Max.x ? |
I probably sort of agree with that, from my perspective the ideal solution would be if I could set the node width explicitly and everything is sized accordingly. I think though (but I may be incorrect) that the problem is that imgui-node-editor cannot know the width of the node until it is fully defined, so it has no chance to set WorkArea (and also there is no official API for it I think)? So far I've just refrained from using any widgets that use the window size (e.g. also collapsing headers), but these things would be super useful to have, so I'm looking for alternative ways. |
That would be a thing to investigate on the imgui-node-editor side.
I'm not sure how it work but I would presume it use temporal coherency or two passes to record width, and it is possible for it to write to WorkArea.Max.x for a given frame.
Normally CollapsingHeader() and Separator() query the current width but only declare the width they need (which in the case of Separator is zero) so that size measurement can may performed. |
Version/Branch of Dear ImGui:
Version 1.90, Branch: docking-layout (imgui-node-editor)
Back-ends:
imgui_impl_vulkan.cpp + imgui_impl_sdl.cpp
Compiler, OS:
MacOS & Linux
Full config/build information:
No response
Details:
I am wondering whether it would be possible to make SeparatorText aware of the item width set by
ImGui::SetNextItemWidth
orImGui::PushItemWidth
Right now, the separators always use the window max x coordinate to determine their width, which is problematic if you want to use them inside a imgui-node-editor node, see reported issue thedmd/imgui-node-editor#214
In many cases the width of the content area in such a node is fixed or can be calculated upfront, and the calculated width can be used to size the controls inside the node. This works fine for most things, but SeparatorText does not listen to the item width set using
SetNextItemWidth
orPushItemWidth
. I don't really see a reason why, it seems like a useful thing to be able to restrict the size of separators.Is there a reason why this would be a bad idea? I can probably implement the changes myself and create a PR, but if it's already known it will not be considered for merging it would be wasted effort because I don't want to keep a customised ImGui branch for my application.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
The text was updated successfully, but these errors were encountered: