fix(layout): nitpicks

This commit is contained in:
Ellen Emilia Anna Zscheile 2025-02-14 21:03:05 +01:00
parent d1be9e753e
commit 82a4ba4724
2 changed files with 7 additions and 9 deletions

View File

@ -149,7 +149,7 @@ impl SegShape {
polygon![p1.0, p2.0, p3.0, p4.0]
}
pub(crate) fn middle_line(&self) -> Line {
pub fn middle_line(&self) -> Line {
Line {
start: self.from.into(),
end: self.to.into(),

View File

@ -363,7 +363,7 @@ impl<R: AccessRules> Layout<R> {
_ => None,
}
}
NodeIndex::Compound(cwidx) => Some(self.node_shape(node).center()),
NodeIndex::Compound(_) => Some(self.node_shape(node).center()),
}
}
@ -416,9 +416,9 @@ impl<R: AccessRules> Layout<R> {
.map(|loose| {
let prim: PrimitiveIndex = loose.into();
let shape = prim.primitive(&self.drawing).shape();
(prim, loose, shape)
(loose, shape)
})
.filter_map(|(prim, loose, shape)| {
.filter_map(|(loose, shape)| {
let band_uid = self.drawing.loose_band_uid(loose);
let loose_hline = orig_hline.orthogonal_through(&match shape {
PrimitiveShape::Seg(seg) => {
@ -443,11 +443,9 @@ impl<R: AccessRules> Layout<R> {
shape,
location
);
if 0.0 <= location && location <= 1.0 {
Some((location, band_uid))
} else {
None
}
(0.0..=1.0)
.contains(&location)
.then_some((location, band_uid))
})
.collect();
bands.sort_by(|a, b| f64::total_cmp(&a.0, &b.0));