mirror of
https://github.com/eliasstepanik/egui_node_graph.git
synced 2026-01-11 13:58:28 +00:00
Merge pull request #59 from kkngsm/constant-snap
fix ConstantOnly bug of port snapping
This commit is contained in:
commit
4db5eea1ab
@ -186,12 +186,13 @@ where
|
|||||||
ports
|
ports
|
||||||
.iter()
|
.iter()
|
||||||
.find_map(|(port_id, _)| {
|
.find_map(|(port_id, _)| {
|
||||||
let port_pos = port_locations[&port_id.into()];
|
port_locations.get(&port_id.into()).and_then(|port_pos| {
|
||||||
if port_pos.distance(cursor_pos) < DISTANCE_TO_CONNECT {
|
if port_pos.distance(cursor_pos) < DISTANCE_TO_CONNECT {
|
||||||
Some(port_pos)
|
Some(*port_pos)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
.unwrap_or(cursor_pos)
|
.unwrap_or(cursor_pos)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user