diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-12-30 10:07:46 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-12-30 10:07:46 +0100 |
| commit | fe1f4400693690b68db5a7ec0976ba998624a740 (patch) | |
| tree | 47f6fb388e70b93312dfe252c50aed637fe37556 /src | |
| parent | 94cf7005e99a9055799a641ae6f00669c5ec7a63 (diff) | |
Clamp shape radii
Diffstat (limited to 'src')
| -rw-r--r-- | src/geom/rounded.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/geom/rounded.rs b/src/geom/rounded.rs index 7a58dae2..dbe21ac6 100644 --- a/src/geom/rounded.rs +++ b/src/geom/rounded.rs @@ -52,6 +52,7 @@ fn stroke_segments( let mut connection = Connection::default(); let mut path = Path::new(); let mut always_continuous = true; + let max_radius = size.x.min(size.y) / 2.0; for side in [Side::Top, Side::Right, Side::Bottom, Side::Left] { let continuous = stroke.get(side) == stroke.get(side.next_cw()); @@ -62,8 +63,8 @@ fn stroke_segments( &mut path, side, size, - radius.get(side.start_corner()), - radius.get(side.end_corner()), + radius.get(side.start_corner()).clamp(Abs::zero(), max_radius), + radius.get(side.end_corner()).clamp(Abs::zero(), max_radius), connection, ); |
