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

Commit

Permalink
Merge pull request #59 from kkngsm/constant-snap
Browse files Browse the repository at this point in the history
fix ConstantOnly bug of port snapping
  • Loading branch information
setzer22 authored Aug 30, 2022
2 parents 4f34143 + 3eef3ac commit 4db5eea
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 4db5eea

Please sign in to comment.