thedmd / imgui-node-editor

Node Editor built using Dear ImGui
MIT License
3.6k stars 536 forks source link

Misalignment when adding child window to node #236

Open vtnoah opened 1 year ago

vtnoah commented 1 year ago

I'm trying to add a child window into a node using the blueprints example by placing the following code between the builder.Begin() and builder.End() statements.

ImGui::BeginChild("Nody", ImVec2(200, 200), true);

ImGui::Button("B", button_sz3);

ImGui::EndChild();

It seems to work but the child window isn't bound into the node. When resizing the window it does seem to clip the child window when the node is clipped. Any ideas what might be going on?

Animation

TamirVered commented 1 year ago

Having the same issue with the contents of a ListBox inside a node

Shiselster commented 1 year ago

Experiencing the same issue here as well, when using Group. Any known workaround or upcoming fix?

thedmd commented 1 year ago

I would need to inspect ImGui to see if canvas would be able to recognize child windows and scale them appropriately. So far workaround is to display widgets containing child windows as popups.

TamirVered commented 12 months ago

Any suggestion on how to make such a popup constantly open and follow the node? So it will fill as if it were its content.

thedmd commented 11 months ago

Nodes are moved in ed::End. To stay in sync it is bess to update popup position after this function is called.

You can query the position of the node (ed::GetNodePosition) and use it to position popup.

ed::CanvasToScreen does convert node position in canvas to screen position ImGui use.