ImNodes icon indicating copy to clipboard operation
ImNodes copied to clipboard

Separator/CollapsingHeader exceeds node's width

Open flamendless opened this issue 4 years ago • 6 comments

		if (ImNodes::Ez::BeginNode(node, node->m_var_name, &node->m_pos, &node->m_selected))
		{
                        ImGui::Separator(); //here
                        //other drawings
		}

results to 2021-03-14_12-15

More testing shows that anywhere the ImGui::Separator() is called as long as inside the ImNodes::Ez::BeginNode and ImNodes::Ez::EndNode it results to the same problem

flamendless avatar Mar 14 '21 04:03 flamendless

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?

sonoro1234 avatar Mar 19 '21 09:03 sonoro1234

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();
	}

flamendless avatar Mar 19 '21 12:03 flamendless

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.

2021-03-23_10-18

Also, this misbehavior happens also for TreeNode (when hovered on the tree title)

flamendless avatar Mar 23 '21 02:03 flamendless

I'm also seeing this when using a table inside a Node:

image

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();
        }

sphaero avatar Mar 18 '22 14:03 sphaero

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?

sphaero avatar Mar 22 '22 15:03 sphaero

A workaround might be to wrap the widgets which exceed the width inside a BeginChild()/EndChild()

sphaero avatar Mar 23 '22 14:03 sphaero