summaryrefslogtreecommitdiffstats
path: root/native/src/widget
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/widget')
-rw-r--r--native/src/widget/button.rs4
-rw-r--r--native/src/widget/container.rs16
-rw-r--r--native/src/widget/text_input.rs3
3 files changed, 18 insertions, 5 deletions
diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs
index 5b0d3e41..f1d46936 100644
--- a/native/src/widget/button.rs
+++ b/native/src/widget/button.rs
@@ -168,9 +168,7 @@ where
.pad(padding);
let mut content = self.content.layout(renderer, &limits);
-
- content.bounds.x = padding;
- content.bounds.y = padding;
+ content.move_to(Point::new(padding, padding));
let size = limits.resolve(content.size()).pad(padding);
diff --git a/native/src/widget/container.rs b/native/src/widget/container.rs
index 5682fc87..3459a832 100644
--- a/native/src/widget/container.rs
+++ b/native/src/widget/container.rs
@@ -77,6 +77,22 @@ where
self.max_height = max_height;
self
}
+
+ /// Sets the content alignment for the horizontal axis of the [`Container`].
+ ///
+ /// [`Container`]: struct.Container.html
+ pub fn align_x(mut self, alignment: Align) -> Self {
+ self.horizontal_alignment = alignment;
+ self
+ }
+
+ /// Sets the content alignment for the vertical axis of the [`Container`].
+ ///
+ /// [`Container`]: struct.Container.html
+ pub fn align_y(mut self, alignment: Align) -> Self {
+ self.vertical_alignment = alignment;
+ self
+ }
/// Centers the contents in the horizontal axis of the [`Container`].
///
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index 04118755..c068b895 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -184,8 +184,7 @@ where
.height(Length::Units(text_size));
let mut text = layout::Node::new(limits.resolve(Size::ZERO));
- text.bounds.x = padding;
- text.bounds.y = padding;
+ text.move_to(Point::new(padding, padding));
layout::Node::with_children(text.size().pad(padding), vec![text])
}