summaryrefslogtreecommitdiffstats
path: root/core/src/layout
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/layout')
-rw-r--r--core/src/layout/flex.rs2
-rw-r--r--core/src/layout/limits.rs7
-rw-r--r--core/src/layout/node.rs10
3 files changed, 12 insertions, 7 deletions
diff --git a/core/src/layout/flex.rs b/core/src/layout/flex.rs
index 2a12d57f..cf3e1340 100644
--- a/core/src/layout/flex.rs
+++ b/core/src/layout/flex.rs
@@ -239,9 +239,9 @@ where
let (intrinsic_width, intrinsic_height) = axis.pack(main - pad.0, cross);
let size = limits.resolve(
- Size::new(intrinsic_width, intrinsic_height),
width,
height,
+ Size::new(intrinsic_width, intrinsic_height),
);
Node::with_children(size.expand(padding), nodes)
diff --git a/core/src/layout/limits.rs b/core/src/layout/limits.rs
index eef4c4c9..7fbc7b9d 100644
--- a/core/src/layout/limits.rs
+++ b/core/src/layout/limits.rs
@@ -114,13 +114,14 @@ impl Limits {
}
}
- /// Computes the resulting [`Size`] that fits the [`Limits`] given the
- /// intrinsic size of some content.
+ /// Computes the resulting [`Size`] that fits the [`Limits`] given
+ /// some width and height requirements and the intrinsic size of
+ /// some content.
pub fn resolve(
&self,
- intrinsic_size: Size,
width: impl Into<Length>,
height: impl Into<Length>,
+ intrinsic_size: Size,
) -> Size {
let width = match width.into() {
Length::Fill | Length::FillPortion(_) => self.max.width,
diff --git a/core/src/layout/node.rs b/core/src/layout/node.rs
index 00087431..40c71436 100644
--- a/core/src/layout/node.rs
+++ b/core/src/layout/node.rs
@@ -89,19 +89,23 @@ impl Node {
}
/// Moves the [`Node`] to the given position.
- pub fn move_to(mut self, position: Point) -> Self {
+ pub fn move_to(mut self, position: impl Into<Point>) -> Self {
self.move_to_mut(position);
self
}
/// Mutable reference version of [`move_to`].
- pub fn move_to_mut(&mut self, position: Point) {
+ pub fn move_to_mut(&mut self, position: impl Into<Point>) {
+ let position = position.into();
+
self.bounds.x = position.x;
self.bounds.y = position.y;
}
/// Translates the [`Node`] by the given translation.
- pub fn translate(self, translation: Vector) -> Self {
+ pub fn translate(self, translation: impl Into<Vector>) -> Self {
+ let translation = translation.into();
+
Self {
bounds: self.bounds + translation,
..self