diff --git a/source/window.cpp b/source/window.cpp index 4ef519b4d..4ab026ae3 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -697,6 +697,7 @@ namespace hex { GImGui = ImGui::CreateContext(); GImPlot = ImPlot::CreateContext(); + GImNodes = ImNodes::CreateContext(); ImGuiIO& io = ImGui::GetIO(); ImGuiStyle& style = ImGui::GetStyle(); @@ -731,6 +732,14 @@ namespace hex { io.KeyMap[ImGuiKey_Y] = GLFW_KEY_Y; io.KeyMap[ImGuiKey_Z] = GLFW_KEY_Z; + ImNodes::PushAttributeFlag(ImNodesAttributeFlags_EnableLinkDetachWithDragClick); + ImNodes::PushAttributeFlag(ImNodesAttributeFlags_EnableLinkCreationOnSnap); + + { + static bool always = true; + ImNodes::GetIO().LinkDetachWithModifierClick.Modifier = &always; + } + io.UserData = new ImGui::ImHexCustomData(); if (this->m_globalScale != 0.0f) @@ -818,8 +827,12 @@ namespace hex { void Window::deinitImGui() { delete static_cast(ImGui::GetIO().UserData); + ImNodes::PopAttributeFlag(); + ImNodes::PopAttributeFlag(); + ImGui_ImplOpenGL3_Shutdown(); ImGui_ImplGlfw_Shutdown(); + ImNodes::DestroyContext(); ImPlot::DestroyContext(); ImGui::DestroyContext(); }