egui: fix selection of polys and vias

This commit is contained in:
Mikolaj Wielgus 2024-07-22 11:10:52 +02:00
parent ca27804c64
commit 61babd179a
1 changed files with 24 additions and 6 deletions

View File

@ -53,12 +53,30 @@ impl Overlay {
)) ))
.collect(); .collect();
if let Some(geom) = geoms.iter().find(|&&geom| match geom.data { if let Some(geom) = geoms.iter().find(|&&geom| {
self.contains_point(board, geom.data, at)
&& match geom.data {
NodeIndex::Primitive(primitive) => { NodeIndex::Primitive(primitive) => {
primitive.primitive(board.layout().drawing()).layer() == self.active_layer primitive.primitive(board.layout().drawing()).layer() == self.active_layer
&& self.contains_point(board, geom.data, at)
} }
NodeIndex::Compound(compound) => false, NodeIndex::Compound(compound) => {
match board.layout().drawing().compound_weight(compound) {
CompoundWeight::Poly(weight) => {
board
.layout()
.poly(GenericIndex::<PolyWeight>::new(
compound.petgraph_index(),
))
.layer()
== self.active_layer
}
CompoundWeight::Via(weight) => {
weight.from_layer >= self.active_layer
&& weight.to_layer <= self.active_layer
}
}
}
}
}) { }) {
self.selection.toggle_at_node(board, geom.data); self.selection.toggle_at_node(board, geom.data);
} }