Open flamendless opened 3 years ago
It seems that the same is happening in Nelarius/imnodes: https://github.com/Nelarius/imnodes/tree/ee6d4071eef5d253e6402e488e93f64208ae195a#known-issues
What happens if everything is inside a Table?
What happens if everything is inside a Table?
It doesn't get drawn properly.
if (ImGui::BeginTable("TableNode##NodeVar", 2, ImGuiTableFlags_SizingFixedFit))
{
ImGui::Separator(); //this doesnt get drawn
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Separator(); //this is drawn but it exceeds the node size as well
ImGui::Text("Name:");
ImGui::Text("Value:");
ImGui::TableNextColumn();
ImGui::Text("%s", m_name);
if (m_value)
m_value->draw();
else
m_value_orig.draw();
ImGui::EndTable();
}
I've renamed the title of this issue as this misbehavior also happens for collapsing header inside the node.
Im trying to draw all the values connected to a certain node.
Also, this misbehavior happens also for TreeNode
(when hovered on the tree title)
I'm also seeing this when using a table inside a Node:
Just this code in a node:
static ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody | ImGuiTableFlags_ScrollX | ImGuiTableFlags_ScrollY;
if (ImGui::BeginTable("table1", 3, flags))
{
for (int row = 0; row < 3; row++)
{
ImGui::TableNextRow();
for (int column = 0; column < 3; column++)
{
ImGui::TableSetColumnIndex(column);
ImGui::Text("Hello %d,%d", column, row);
}
}
ImGui::EndTable();
}
This needs some inside ImGui perspective. I think it might be caused by the fact that item space is provided by a window and a Node is not a window.
See here for the separator: https://github.com/ocornut/imgui/blob/6fae29679a8f9b163f6ef11bd643c4aa859cc31b/imgui_widgets.cpp#L1393
It jus gets the max width from the underlying window. When we're in a node this should be the max width of the node. Perhaps we need to register nodes as a window?
A workaround might be to wrap the widgets which exceed the width inside a BeginChild()/EndChild()
results to![2021-03-14_12-15](https://user-images.githubusercontent.com/17418737/111057016-145a1500-84bf-11eb-88f9-a7225b559ade.png)
More testing shows that anywhere the ImGui::Separator() is called as long as inside the
ImNodes::Ez::BeginNode
andImNodes::Ez::EndNode
it results to the same problem