imgui-node-editor icon indicating copy to clipboard operation
imgui-node-editor copied to clipboard

An initialization problem of "Begin()"

Open jkooooo99 opened this issue 2 years ago • 1 comments

It seems like Node Editor can not initialize correctly when the ImGui::GetContentRegionAvail() returns an {0, 0} (or {-123,-456}, etc.)...

But If I have a complex layout ( I am using the docking branch of imgui ), there may be such a moment that the "region" is (0,0) or even minus numbers.

And Node Editor will definitely throw an error! 20230208

For now, I fix it with a simple "if" check.

                        ImGui::Begin("##window");
                        auto size = ImGui::GetContentRegionAvail();
			if (size.x <= 0 || size.y <= 0)
                        {
				ImGui::End();
				return;
			}

                       ed::Begin("##editor");
                       //...
                       ed::End();
                       ImGui::End();

20230208

There is one more bug when I am using the docking branch... It will show a weird scrollbar when I drag the window to another screen.

20230208

And I am suppressing it with an "ImGuiWindowFlags_NoScrollbar" child window...

Sorry for my poor English.

jkooooo99 avatar Feb 08 '23 03:02 jkooooo99

I think this is same issue that #186 is trying to address. You can try to pick changes from there before fix for the issue land on the main branch.

Does that change solve problem for you?

thedmd avatar May 02 '23 00:05 thedmd