diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 3725079..78fcc8e 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -73,7 +73,7 @@ find_package(ImGui REQUIRED SourcesMiscCpp) CPMAddPackage( NAME imnodes GITHUB_REPOSITORY Auburn/imnodes - GIT_TAG 1aa48f4af2a4f9f1b9a6ed53fe858ed76646b233 + GIT_TAG 9d89b3e98c91ba2b414c9ad1cdf7e9c48510c6f0 GIT_SUBMODULES ".github" EXCLUDE_FROM_ALL YES OPTIONS diff --git a/tools/FastNoiseNodeEditor.cpp b/tools/FastNoiseNodeEditor.cpp index 18b305d..5f561a0 100644 --- a/tools/FastNoiseNodeEditor.cpp +++ b/tools/FastNoiseNodeEditor.cpp @@ -661,7 +661,7 @@ void FastNoiseNodeEditor::Draw( const Matrix4& transformation, const Matrix4& pr } ImGuiExtra::MarkSettingsDirty(); - } + } ImNodes::BeginNodeEditor(); @@ -673,15 +673,27 @@ void FastNoiseNodeEditor::Draw( const Matrix4& transformation, const Matrix4& pr ImNodes::MiniMap( 0.2f, ImNodesMiniMapLocation_BottomLeft ); -#if 0 - if( ImGui::IsWindowHovered() ) + ImNodes::EndNodeEditor(); + + // Zoom + if( ImNodes::IsEditorHovered() && ImGui::GetIO().MouseWheel != 0 ) { - auto zoom = ImNodes::EditorContextGetZoom() + ImGui::GetIO().MouseWheel * 0.1f; + float zoom = ImNodes::EditorContextGetZoom(); + if( ImGui::GetIO().MouseWheel > 0 ) + { + zoom *= 1.5f; + if( zoom > 0.9f ) + { + zoom = 1; + } + } + else + { + zoom /= 1.5f; + zoom = std::max( zoom, 0.2f ); + } ImNodes::EditorContextSetZoom( zoom, ImGui::GetMousePos() ); } -#endif - - ImNodes::EndNodeEditor(); CheckLinks(); @@ -1115,6 +1127,10 @@ void FastNoiseNodeEditor::DoHelp() ImGui::SameLine( alignPx ); ImGui::TextUnformatted( "Right mouse drag" ); + ImGui::TextUnformatted( "Zoom graph" ); + ImGui::SameLine( alignPx ); + ImGui::TextUnformatted( "Mouse wheel" ); + ImGui::TextUnformatted( "Delete node/link" ); ImGui::SameLine( alignPx ); ImGui::TextUnformatted( "Backspace or Delete" ); diff --git a/tools/NodeEditorApp.cpp b/tools/NodeEditorApp.cpp index 4a9fa55..b8d6884 100644 --- a/tools/NodeEditorApp.cpp +++ b/tools/NodeEditorApp.cpp @@ -46,6 +46,7 @@ NodeEditorApp::NodeEditorApp( const Arguments& arguments ) : } ImGui::GetIO().IniFilename = "NodeEditor.ini"; + ImGui::GetIO().ConfigDragClickToInputText = true; mImGuiIntegrationContext = ImGuiIntegration::Context( *mImGuiContext, size, windowSize(), framebufferSize() ); GL::Renderer::enable( GL::Renderer::Feature::DepthTest );