imgui-node-editor
imgui-node-editor copied to clipboard
Using tables API
Here there is problem with tables:
The "edge" position depends on window size AND position
How can I fix this?
A minimal code example would be somewhat helpful to anyone wanting to debug this.
@gnif ok, here it is:
void Draw()
{
static bool firstFrame = true;
static ImGuiTableFlags flags = ImGuiTableFlags_PadOuterX | ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_Borders;
static float nodeWidth = 128.0f;
int uniqueId = 1;
ImGui::SetNextWindowPos(ImVec2(94.0f, 164.0f), ImGuiCond_Once);
ImGui::SetNextWindowSize(ImVec2(344.0f, 178.0f), ImGuiCond_Once);
NodeEditor::Begin("My editor");
NodeEditor::BeginNode(uniqueId++);
if (ImGui::BeginTable("Node", 2, flags))
{
float columnWidth = nodeWidth * 0.5f;
ImGui::TableSetupColumn("Inputs", ImGuiTableColumnFlags_WidthFixed, columnWidth);
ImGui::TableSetupColumn("Outputs", ImGuiTableColumnFlags_WidthFixed, columnWidth);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextUnformatted("Hello");
ImGui::TableNextColumn();
ImGui::TextUnformatted("World!");
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::TextUnformatted("Hello");
ImGui::TableNextColumn();
ImGui::TextUnformatted("World!");
}
ImGui::EndTable();
NodeEditor::EndNode();
NodeEditor::End();
if (firstFrame)
{
firstFrame = false;
NodeEditor::SetNodePosition(uniqueId - 1, ImVec2(352.0f, -192.0f));
NodeEditor::NavigateToContent();
}
}
Try to change window size and position.
I think it is so much easier to create a layot with tables rather than with stack layout.
P.S. accedetically closed, sorry
Tables are much younger that stack layouts and node editor. I need to investigate how to address this issue.
Tables are much younger that stack layouts and node editor. I need to investigate how to address this issue.
After playing around with stack layout, I finally managed to put things together :)

It seems this bug is still present. is there workaround to have actual tables inside nodes?
A fixed table size will work correctly, but you don't manually define the table size, this bug occurs :(