feat: Introduce NodeId type decoupled from egui::Id#41
Merged
mitchmindtree merged 2 commits intonannou-org:mainfrom Jan 17, 2026
Merged
feat: Introduce NodeId type decoupled from egui::Id#41mitchmindtree merged 2 commits intonannou-org:mainfrom
NodeId type decoupled from egui::Id#41mitchmindtree merged 2 commits intonannou-org:mainfrom
Conversation
Add a dedicated `NodeId` type for identifying nodes within a graph, separate from egui's internal `Id` type. This allows node identity and layout positions to remain stable even when the graph widget's egui ID context changes (e.g., when viewing the same graph through different UI paths or contexts). Key changes: - Add `NodeId` wrapper type around `u64` with constructors - Change `Layout` from `HashMap<egui::Id, Pos2>` to `HashMap<NodeId, Pos2>` - Update `Node::from_id` to accept `NodeId` instead of `egui::Id` - Update `Edge` to use `NodeId` for node references - Add `node::egui_id(graph_id, node_id)` helper to derive internal egui::Id for area_rect lookups - Update selection tracking to use `NodeId` - Update `layout()` function signature to use `NodeId` BREAKING CHANGE: Public API now uses `NodeId` instead of `egui::Id` for node identification. Users must update their code to use `NodeId::new()`, `NodeId::from_u64()`, or `NodeId::from()`.
cfbc5e3 to
e347bdb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a dedicated
NodeIdtype for identifying nodes within a graph, separate from egui's internalIdtype. This allows node identity and layout positions to remain stable even when the graph widget's egui ID context changes (e.g., when viewing the same graph through different UI paths or contexts).Key changes:
NodeIdwrapper type aroundu64with constructorsLayoutfromHashMap<egui::Id, Pos2>toHashMap<NodeId, Pos2>Node::from_idto acceptNodeIdinstead ofegui::IdEdgeto useNodeIdfor node referencesnode::egui_id(graph_id, node_id)helper to derive internalegui::Id for area_rect lookups
NodeIdlayout()function signature to useNodeIdBREAKING CHANGE: Public API now uses
NodeIdinstead ofegui::Idfor node identification. Users must update their code to useNodeId::new(),NodeId::from_u64(), orNodeId::from().