id is not set correctly, fix needed

This commit is contained in:
Sebastian
2024-11-04 09:53:08 +01:00
parent 374efbe47c
commit 0c797807dd
2 changed files with 31 additions and 4 deletions
+6
View File
@@ -142,6 +142,12 @@ namespace VISEQ::GRAPH {
return possible_connections.at(return_path)->getNextNode(current);
}
SPTR_Node getClosestNode(Vec2Df position){
auto neighbors = nodes | RANGE_FILTER([](SPTR_Node n){ return !n->dragging;}) | std::ranges::to<VEC_SPTR_Node>();
std::sort(neighbors.begin(), neighbors.end(), [position](SPTR_Node na, SPTR_Node nb){ return na->position.dist(position) < nb->position.dist(position);});
return neighbors.front();
}
void addConnection(SPTR_Node from, SPTR_Node to){
if(from != to) {
edges.emplace_back(std::make_shared<Edge>());