summaryrefslogtreecommitdiffstats
path: root/native/src/layout/node.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-15 00:50:36 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-02-15 00:50:36 +0100
commit4969bfdb66cf2b33033cb642423bc326e288e15b (patch)
tree030a56e38af9af6704f1f02ff52997f34e126959 /native/src/layout/node.rs
parentf5c80a6d75d5022b175d3562f0965598b6398bd7 (diff)
parentcf53026b51df390d98d37f93259b7b7b0a25c6f8 (diff)
downloadiced-4969bfdb66cf2b33033cb642423bc326e288e15b.tar.gz
iced-4969bfdb66cf2b33033cb642423bc326e288e15b.tar.bz2
iced-4969bfdb66cf2b33033cb642423bc326e288e15b.zip
Merge branch 'master' into feature/canvas
Diffstat (limited to 'native/src/layout/node.rs')
-rw-r--r--native/src/layout/node.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/native/src/layout/node.rs b/native/src/layout/node.rs
index ed1cd3da..11e93b72 100644
--- a/native/src/layout/node.rs
+++ b/native/src/layout/node.rs
@@ -1,9 +1,9 @@
-use crate::{Align, Rectangle, Size};
+use crate::{Align, Point, Rectangle, Size};
/// The bounds of an element and its children.
#[derive(Debug, Clone, Default)]
pub struct Node {
- pub(crate) bounds: Rectangle,
+ bounds: Rectangle,
children: Vec<Node>,
}
@@ -54,7 +54,10 @@ impl Node {
&self.children
}
- pub(crate) fn align(
+ /// Aligns the [`Node`] in the given space.
+ ///
+ /// [`Node`]: struct.Node.html
+ pub fn align(
&mut self,
horizontal_alignment: Align,
vertical_alignment: Align,
@@ -80,4 +83,12 @@ impl Node {
}
}
}
+
+ /// Moves the [`Node`] to the given position.
+ ///
+ /// [`Node`]: struct.Node.html
+ pub fn move_to(&mut self, position: Point) {
+ self.bounds.x = position.x;
+ self.bounds.y = position.y;
+ }
}