Live Corners: drop the single-corner radius limits nothing uses since #2332

This commit is contained in:
bflatastic
2026-10-17 13:20:26 +07:00
parent 8875b3fbca
commit d5561d6e02
2 changed files with 0 additions and 17 deletions
-9
View File
@@ -148,12 +148,6 @@ impl Corner {
self.radius_at_setback(room(self.lu, before).min(room(self.lv, after)))
}
/// The radius the corner is drawn with whatever its neighbours do: `radius`, no larger than
/// [`Corner::max_radius`], 0 when negative or not a number.
pub fn fitted(&self, radius: f64) -> f64 {
radius.max(0.0).min(self.max_radius())
}
/// The largest radius the corner draws when it and the corners for which `edited` holds are
/// set to one radius together, the other corners of `corners` keeping their `radii` (by
/// anchor index). A side shared with an edited corner takes both cuts as far as they fit
@@ -422,9 +416,6 @@ mod tests {
for c in &corners {
let max = c.max_radius();
assert!((c.setback(max) - c.lu.min(c.lv) / 2.0).abs() < 1e-9);
assert_eq!(c.fitted(1e6), max);
assert_eq!(c.fitted(-3.0), 0.0);
assert_eq!(c.fitted(f64::NAN), 0.0);
}
// The right angle at (0, 0) takes up to 20, half its shorter side.
assert!((corners[0].max_radius() - 20.0).abs() < 1e-9);
-8
View File
@@ -52,13 +52,6 @@ pub fn max_corner_radius(w: f64, h: f64) -> f64 {
w.abs().min(h.abs()) / 2.0
}
/// The radius a corner of a `w` × `h` rectangle is drawn with: `radius`, no larger than
/// [`max_corner_radius`] (the same limit for every corner, so opposite corners match), 0 when
/// negative or not a number.
pub fn fitted_corner_radius(w: f64, h: f64, radius: f64) -> f64 {
radius.max(0.0).min(max_corner_radius(w, h))
}
/// The radii the corners of a `w` × `h` rectangle (top-left, top-right, bottom-right,
/// bottom-left) are drawn with: each its own, no larger than leaves room for its neighbours'
/// cuts ([`crate::corners::fitted_radii`]): half the shorter side when they are all as large, up
@@ -409,7 +402,6 @@ mod tests {
fn corners_of_a_non_square_rectangle_are_alike() {
let r = Rect::new(0.0, 0.0, 200.0, 80.0);
assert_eq!(max_corner_radius(-200.0, 80.0), 40.0);
assert_eq!([30.0, 60.0, -1.0, f64::NAN].map(|x| fitted_corner_radius(200.0, 80.0, x)), [30.0, 40.0, 0.0, 0.0]);
for (radius, drawn) in [(30.0, 30.0), (60.0, 40.0)] {
for kinds in [[CornerKind::Round; 4], [CornerKind::Chamfer, CornerKind::InvertedRound, CornerKind::Round, CornerKind::Chamfer]] {
let a: Vec<Point> = rectangle_with_corners(r, [radius; 4], kinds).subpaths[0].anchors.iter().map(|a| a.p).collect();