summaryrefslogtreecommitdiffstats
path: root/native/src/layout
diff options
context:
space:
mode:
authorLibravatar daxpedda <daxpedda@gmail.com>2020-02-14 15:57:07 +0100
committerLibravatar daxpedda <daxpedda@gmail.com>2020-02-14 15:57:07 +0100
commitb72bd0b2b5c9c2a5c3f508a13ad9578169046a36 (patch)
treef75af65b619a364fd4b175e0e334f4d57df9766b /native/src/layout
parent457d6f616af7359029b07d34d7e6cc1ab6cc6793 (diff)
downloadiced-b72bd0b2b5c9c2a5c3f508a13ad9578169046a36.tar.gz
iced-b72bd0b2b5c9c2a5c3f508a13ad9578169046a36.tar.bz2
iced-b72bd0b2b5c9c2a5c3f508a13ad9578169046a36.zip
Add `bound` to `Node` constructor.
Diffstat (limited to 'native/src/layout')
-rw-r--r--native/src/layout/flex.rs1
-rw-r--r--native/src/layout/node.rs10
2 files changed, 6 insertions, 5 deletions
diff --git a/native/src/layout/flex.rs b/native/src/layout/flex.rs
index bd37b75a..02037b14 100644
--- a/native/src/layout/flex.rs
+++ b/native/src/layout/flex.rs
@@ -174,6 +174,7 @@ where
Node::with_children(
Size::new(size.width + padding * 2.0, size.height + padding * 2.0),
+ Size::ZERO,
nodes,
)
}
diff --git a/native/src/layout/node.rs b/native/src/layout/node.rs
index fae6e330..e9885725 100644
--- a/native/src/layout/node.rs
+++ b/native/src/layout/node.rs
@@ -12,19 +12,19 @@ impl Node {
///
/// [`Node`]: struct.Node.html
/// [`Size`]: ../struct.Size.html
- pub fn new(size: Size) -> Self {
- Self::with_children(size, Vec::new())
+ pub fn new(size: Size, bound: Size) -> Self {
+ Self::with_children(size, bound, Vec::new())
}
/// Creates a new [`Node`] with the given [`Size`] and children.
///
/// [`Node`]: struct.Node.html
/// [`Size`]: ../struct.Size.html
- pub fn with_children(size: Size, children: Vec<Node>) -> Self {
+ pub fn with_children(size: Size, bound: Size, children: Vec<Node>) -> Self {
Node {
bounds: Rectangle {
- x: 0.0,
- y: 0.0,
+ x: bound.width,
+ y: bound.height,
width: size.width,
height: size.height,
},