Based on the splitter function in the ImGui Node Editor blueprints-example.cpp
| 63 | |
| 64 | // Based on the splitter function in the ImGui Node Editor blueprints-example.cpp |
| 65 | static bool splitter(bool split_vertically, float thickness, float* size1, float* size2, float min_size1, float min_size2, float splitter_long_axis_size = -1.0f) |
| 66 | { |
| 67 | using namespace ImGui; |
| 68 | ImGuiContext& g = *GImGui; |
| 69 | ImGuiWindow* window = g.CurrentWindow; |
| 70 | ImGuiID id = window->GetID("##Splitter"); |
| 71 | ImRect bb; |
| 72 | bb.Min = window->DC.CursorPos + (split_vertically ? ImVec2(*size1, 0.0f) : ImVec2(0.0f, *size1)); |
| 73 | bb.Max = bb.Min + CalcItemSize(split_vertically ? ImVec2(thickness, splitter_long_axis_size) : ImVec2(splitter_long_axis_size, thickness), 0.0f, 0.0f); |
| 74 | return SplitterBehavior(bb, id, split_vertically ? ImGuiAxis_X : ImGuiAxis_Y, size1, size2, min_size1, min_size2, 0.0f); |
| 75 | } |
| 76 | |
| 77 | // Based on showLabel from ImGui Node Editor blueprints-example.cpp |
| 78 | auto showLabel = [](const char* label, ImColor color) |