Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
fix ConstantOnly bug of port snapping
Browse files Browse the repository at this point in the history
  • Loading branch information
apostich committed Aug 26, 2022
1 parent eeecd63 commit 3eef3ac
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions egui_node_graph/src/editor_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,13 @@ where
ports
.iter()
.find_map(|(port_id, _)| {
let port_pos = port_locations[&port_id.into()];
if port_pos.distance(cursor_pos) < DISTANCE_TO_CONNECT {
Some(port_pos)
} else {
None
}
port_locations.get(&port_id.into()).and_then(|port_pos| {
if port_pos.distance(cursor_pos) < DISTANCE_TO_CONNECT {
Some(*port_pos)
} else {
None
}
})
})
.unwrap_or(cursor_pos)
}
Expand Down

0 comments on commit 3eef3ac

Please sign in to comment.