Arnaud Loonstra
Arnaud Loonstra
Don't merge it yet. I still haven't found an approach that doesn't have the side effects. I haven't worked on it either. So either close this PR or leave it...
actually the vertical scrollbar also doesn't function. It conflicts with canvas->offset. A fix would be to do something like: ``` canvas->offset.x = -ImGui::GetScrollX(); canvas->offset.y = -ImGui::GetScrollY(); ``` But then scroll...
That would be a nice workaround as well. I'll try that. Hope you don't mind me shooting in these little bugs. I'll get to pull requests once I find more...
From what I tested it doesn't: ``` if ( ImGui::Begin("clientspanel", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBringToFrontOnFocus) ) { ImGui::BeginChild("testchild", ImVec2(0,0), ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_HorizontalScrollbar); ImNodes::BeginCanvas(gCanvas); ... ```
``` if ( ImGui::Begin("clientspanel", NULL, ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_HorizontalScrollbar | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBringToFrontOnFocus) ) { ImGui::BeginChild("testchild"); ImNodes::BeginCanvas(gCanvas); ``` still doesn't work. But the scrollbar should be determined...
Best working code for now is to set scroll value before calling BeginCanvas ``` ImGui::BeginChild("testchild"); canvas.offset.y = -ImGui::GetScrollY(); ImNodes::BeginCanvas(&canvas); ``` However this does not work if you move nodes upward...
From what I read so far I think the canvas needs a rectangle from which scroll position can be determined. But I have a feeling it could be simpler I...
Another test. It seems its easiest to just draw the canvas inside a Begin/EndChild as you suggested. I don't think `offset` is need then. You'll get a functioning scrolling. Here's...
Note to self: Another approach would be to render a custom Scrollbar based on ImGui::Scrollbar
Hey Omar. Thanks for responding. Forget previous comments. Basically we have an infinite canvas defined by a Begin/EndCanvas. https://github.com/rokups/ImNodes/blob/a62c20f67b3d2f877bdc23acf74687ca6442fb78/ImNodes.cpp#L213 BeginCanvas draws the grid in the content area of the window...