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

fix ConstantOnly bug of port snapping #59

Merged
merged 1 commit into from
Aug 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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