fix(geometry/edit): Find first gear correctly, don't rely on edge order

This commit is contained in:
Mikolaj Wielgus 2025-07-17 01:36:21 +02:00
parent 4fea23c9ac
commit 42c788063b
1 changed files with 6 additions and 1 deletions

View File

@ -546,7 +546,12 @@ impl<
> Geometry<PW, DW, SW, BW, CW, Cel, PI, DI, SI, BI>
{
pub fn first_rail(&self, node: NodeIndex<usize>) -> Option<BI> {
self.all_rails(node).next()
self.all_rails(node).find(|bend| {
!self
.graph
.edges_directed(bend.petgraph_index(), Incoming)
.any(|edge| matches!(edge.weight(), GeometryLabel::Outer))
})
}
pub fn all_rails(&self, node: NodeIndex<usize>) -> impl Iterator<Item = BI> + '_ {