diff options
Diffstat (limited to '')
| -rw-r--r-- | native/src/layout/flex.rs | 1 | ||||
| -rw-r--r-- | native/src/layout/node.rs | 10 | ||||
| -rw-r--r-- | native/src/user_interface.rs | 2 | ||||
| -rw-r--r-- | native/src/widget/button.rs | 4 | ||||
| -rw-r--r-- | native/src/widget/container.rs | 5 | ||||
| -rw-r--r-- | native/src/widget/image.rs | 2 | ||||
| -rw-r--r-- | native/src/widget/progress_bar.rs | 2 | ||||
| -rw-r--r-- | native/src/widget/scrollable.rs | 2 | ||||
| -rw-r--r-- | native/src/widget/slider.rs | 2 | ||||
| -rw-r--r-- | native/src/widget/space.rs | 2 | ||||
| -rw-r--r-- | native/src/widget/svg.rs | 2 | ||||
| -rw-r--r-- | native/src/widget/text.rs | 2 | ||||
| -rw-r--r-- | native/src/widget/text_input.rs | 9 | 
13 files changed, 25 insertions, 20 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,              }, diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 08914bed..b8fe7848 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -307,7 +307,7 @@ impl Cache {      pub fn new() -> Cache {          Cache {              hash: 0, -            layout: layout::Node::new(Size::new(0.0, 0.0)), +            layout: layout::Node::new(Size::ZERO, Size::ZERO),              bounds: Size::ZERO,              cursor_position: Point::new(-1.0, -1.0),          } diff --git a/native/src/widget/button.rs b/native/src/widget/button.rs index 5b0d3e41..73be4d49 100644 --- a/native/src/widget/button.rs +++ b/native/src/widget/button.rs @@ -7,7 +7,7 @@  use crate::{      input::{mouse, ButtonState},      layout, Clipboard, Element, Event, Hasher, Layout, Length, Point, -    Rectangle, Widget, +    Rectangle, Size, Widget,  };  use std::hash::Hash; @@ -174,7 +174,7 @@ where          let size = limits.resolve(content.size()).pad(padding); -        layout::Node::with_children(size, vec![content]) +        layout::Node::with_children(size, Size::ZERO, vec![content])      }      fn on_event( diff --git a/native/src/widget/container.rs b/native/src/widget/container.rs index 3459a832..d2065234 100644 --- a/native/src/widget/container.rs +++ b/native/src/widget/container.rs @@ -2,7 +2,7 @@  use std::hash::Hash;  use crate::{ -    layout, Align, Clipboard, Element, Event, Hasher, Layout, Length, Point, +    layout, Align, Clipboard, Size, Element, Event, Hasher, Layout, Length, Point,      Rectangle, Widget,  }; @@ -77,7 +77,6 @@ where          self.max_height = max_height;          self      } -          /// Sets the content alignment for the horizontal axis of the [`Container`].      ///      /// [`Container`]: struct.Container.html @@ -149,7 +148,7 @@ where          content.align(self.horizontal_alignment, self.vertical_alignment, size); -        layout::Node::with_children(size, vec![content]) +        layout::Node::with_children(size, Size::ZERO, vec![content])      }      fn on_event( diff --git a/native/src/widget/image.rs b/native/src/widget/image.rs index 200401f9..6938f5d5 100644 --- a/native/src/widget/image.rs +++ b/native/src/widget/image.rs @@ -88,7 +88,7 @@ where              size.height = height as f32 * size.width / width as f32;          } -        layout::Node::new(size) +        layout::Node::new(size, Size::ZERO)      }      fn draw( diff --git a/native/src/widget/progress_bar.rs b/native/src/widget/progress_bar.rs index 67d1ab83..d011cc8a 100644 --- a/native/src/widget/progress_bar.rs +++ b/native/src/widget/progress_bar.rs @@ -95,7 +95,7 @@ where          let size = limits.resolve(Size::ZERO); -        layout::Node::new(size) +        layout::Node::new(size, Size::ZERO)      }      fn draw( diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index e83f25af..6408a3d2 100644 --- a/native/src/widget/scrollable.rs +++ b/native/src/widget/scrollable.rs @@ -143,7 +143,7 @@ where          let content = self.content.layout(renderer, &child_limits);          let size = limits.resolve(content.size()); -        layout::Node::with_children(size, vec![content]) +        layout::Node::with_children(size, Size::ZERO, vec![content])      }      fn on_event( diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs index 008203fe..c554fb9e 100644 --- a/native/src/widget/slider.rs +++ b/native/src/widget/slider.rs @@ -135,7 +135,7 @@ where          let size = limits.resolve(Size::ZERO); -        layout::Node::new(size) +        layout::Node::new(size, Size::ZERO)      }      fn on_event( diff --git a/native/src/widget/space.rs b/native/src/widget/space.rs index 24c94bf6..899c258e 100644 --- a/native/src/widget/space.rs +++ b/native/src/widget/space.rs @@ -62,7 +62,7 @@ where      ) -> layout::Node {          let limits = limits.width(self.width).height(self.height); -        layout::Node::new(limits.resolve(Size::ZERO)) +        layout::Node::new(limits.resolve(Size::ZERO), Size::ZERO)      }      fn draw( diff --git a/native/src/widget/svg.rs b/native/src/widget/svg.rs index 063730bb..60d403ef 100644 --- a/native/src/widget/svg.rs +++ b/native/src/widget/svg.rs @@ -85,7 +85,7 @@ where              size.height = height as f32 * size.width / width as f32;          } -        layout::Node::new(size) +        layout::Node::new(size, Size::ZERO)      }      fn draw( diff --git a/native/src/widget/text.rs b/native/src/widget/text.rs index e4490fb6..ef8a9dbc 100644 --- a/native/src/widget/text.rs +++ b/native/src/widget/text.rs @@ -140,7 +140,7 @@ where          let size = limits.resolve(Size::new(width, height)); -        layout::Node::new(size) +        layout::Node::new(size, Size::ZERO)      }      fn draw( diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index 04118755..42aa3d69 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -183,11 +183,16 @@ where              .max_width(self.max_width)              .height(Length::Units(text_size)); -        let mut text = layout::Node::new(limits.resolve(Size::ZERO)); +        let mut text = +            layout::Node::new(limits.resolve(Size::ZERO), Size::ZERO);          text.bounds.x = padding;          text.bounds.y = padding; -        layout::Node::with_children(text.size().pad(padding), vec![text]) +        layout::Node::with_children( +            text.size().pad(padding), +            Size::ZERO, +            vec![text], +        )      }      fn on_event( | 
