Fix LiveCorners::style to report stored radii, not fitted draw sizes.

Star corners with a large uniform radius kept None in the panel because fitted draw radii differ per tip; tests and UI expect the value the user set.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
nrq6993-a11y
2026-10-21 23:38:03 +07:00
committed by bflatastic
co-authored by Cursor
parent ab0ddf0eae
commit 59534c1cbb
+4 -3
View File
@@ -187,14 +187,15 @@ impl<'a> LiveCorners<'a> {
&self.sources
}
/// The radius (document units) and kind `corners` share (each `None` when they differ, or
/// for no corners).
/// The radius and kind `corners` share (each `None` when they differ, or for no corners).
/// Radius is what was set ([`LiveCorners::radius`]: document lengths, or a fraction in 0..1
/// when [`LiveCorners::radii_relative`]), not the fitted draw size ([`LiveCorners::drawn_radius`]).
pub fn style(&self, corners: &BTreeSet<usize>) -> (Option<f64>, Option<CornerKind>) {
fn shared<T: Copy>(mut it: impl Iterator<Item = T>, same: impl Fn(T, T) -> bool) -> Option<T> {
let first = it.next()?;
it.all(|x| same(x, first)).then_some(first)
}
let radius = shared(corners.iter().map(|k| self.drawn_radius(*k)), |a, b| (a - b).abs() < 1e-9);
let radius = shared(corners.iter().map(|k| self.radius(*k)), |a, b| (a - b).abs() < 1e-9);
(radius, shared(corners.iter().map(|k| self.kind(*k)), |a, b| a == b))
}
}