Skip to content
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

Separator/CollapsingHeader exceeds node's width #30

Open
flamendless opened this issue Mar 14, 2021 · 6 comments
Open

Separator/CollapsingHeader exceeds node's width #30

flamendless opened this issue Mar 14, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@flamendless
Copy link

flamendless commented Mar 14, 2021

		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

@sonoro1234
Copy link
Contributor

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?

@flamendless
Copy link
Author

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

@rokups rokups added the bug Something isn't working label Mar 22, 2021
@flamendless flamendless changed the title Separator exceeds node's width Separator/CollapsingHeader exceeds node's width Mar 23, 2021
@flamendless
Copy link
Author

flamendless commented Mar 23, 2021

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)

@sphaero
Copy link
Contributor

sphaero commented Mar 18, 2022

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
Copy link
Contributor

sphaero commented Mar 22, 2022

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
Copy link
Contributor

sphaero commented Mar 23, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants