Skip to content

Commit e257d4d

Browse files
committed
Don't zoom node editor when scrolling enums
1 parent 57973f6 commit e257d4d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

tools/NodeEditor/FastNoiseNodeEditor.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ FastNoiseNodeEditor::FastNoiseNodeEditor( NodeEditorApp& nodeEditorApp ) :
656656
state = FastNoise::Metadata::DebugCheckVectorStorageSize( debugMetadataVectorCheckIdx++ );
657657
if( state.first > 0 )
658658
{
659-
Error{} << "Non-optimal metadata vector, in FastNoise Metadata.cpp adjust gMetadataVectorSize " << state.second << " to: " << state.first;
659+
Error{} << "Non-optimal metadata vector, in FastNoise Metadata.cpp adjust gMetadataVectorSize<" << state.second << "> to: " << state.first;
660660
}
661661

662662
} while( state.second );
@@ -838,13 +838,16 @@ void FastNoiseNodeEditor::Draw( const Matrix4& transformation, const Matrix4& pr
838838

839839
ImNodes::MiniMap( 0.2f, ImNodesMiniMapLocation_BottomLeft );
840840

841+
// Capture in the editor imgui context
842+
float editorMouseWheel = ImGui::GetIO().MouseWheel;
843+
841844
ImNodes::EndNodeEditor();
842845

843846
// Zoom
844-
if( ImNodes::IsEditorHovered() && ImGui::GetIO().MouseWheel != 0 )
847+
if( ImNodes::IsEditorHovered() && editorMouseWheel != 0 )
845848
{
846849
float zoom = ImNodes::EditorContextGetZoom();
847-
if( ImGui::GetIO().MouseWheel > 0 )
850+
if( editorMouseWheel > 0 )
848851
{
849852
zoom *= 1.5f;
850853
if( zoom > 0.9f )
@@ -1111,7 +1114,7 @@ void FastNoiseNodeEditor::DoNodes()
11111114
}
11121115
ImGui::PopStyleVar();
11131116

1114-
ImGui::PushItemWidth( 60.0f );
1117+
ImGui::PushItemWidth( 90.0f );
11151118

11161119
ImNodes::PushAttributeFlag( ImNodesAttributeFlags_EnableLinkCreationOnSnap );
11171120
ImNodes::PushAttributeFlag( ImNodesAttributeFlags_EnableLinkDetachWithDragClick );

tools/NodeEditor/util/ImGuiExtra.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ namespace ImGuiExtra
3434
if( ImGui::GetIO().MouseWheel < 0 && *comboIndex < comboCount - 1 )
3535
{
3636
(*comboIndex)++;
37+
ImGui::GetIO().MouseWheel = 0;
3738
return true;
3839
}
3940

4041
if( ImGui::GetIO().MouseWheel > 0 && *comboIndex > 0 )
4142
{
4243
(*comboIndex)--;
44+
ImGui::GetIO().MouseWheel = 0;
4345
return true;
4446
}
4547
}

0 commit comments

Comments
 (0)