diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-18 00:58:32 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-18 00:58:32 +0100 |
| commit | b2e6a297893348a871fba8997017a9fc98d5674b (patch) | |
| tree | c88f18c063d97d91712185c58ccf1cd745663cc1 /src/library/shape.rs | |
| parent | d9c529347d7f46eb2f4698d256b1906c1ced6b76 (diff) | |
Refactoring
Diffstat (limited to 'src/library/shape.rs')
| -rw-r--r-- | src/library/shape.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/library/shape.rs b/src/library/shape.rs index 5d9b4152..7c543958 100644 --- a/src/library/shape.rs +++ b/src/library/shape.rs @@ -1,7 +1,6 @@ use std::f64::consts::SQRT_2; use super::prelude::*; -use super::PadNode; use crate::util::RcExt; /// `rect`: A rectangle with optional content. @@ -113,10 +112,8 @@ impl Layout for ShapeNode { if matches!(self.kind, ShapeKind::Circle | ShapeKind::Ellipse) { // Padding with this ratio ensures that a rectangular child fits // perfectly into a circle / an ellipse. - storage = PadNode { - padding: Sides::splat(Relative::new(0.5 - SQRT_2 / 4.0).into()), - child: child.clone(), - }; + let ratio = Relative::new(0.5 - SQRT_2 / 4.0); + storage = child.clone().padded(Sides::splat(ratio.into())); node = &storage; } |
