From 36c3160c398c9ba88e407d1f7254f399fd2e44bf Mon Sep 17 00:00:00 2001 From: Louis-Simon Mc Nicoll <> Date: Tue, 11 Feb 2020 18:09:20 -0500 Subject: [PATCH 1/8] Container support for Align::End --- native/src/widget/container.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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`]. /// From 457d6f616af7359029b07d34d7e6cc1ab6cc6793 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 14 Feb 2020 15:36:33 +0100 Subject: [PATCH 2/8] Make `Node::align` public. --- native/src/layout/node.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/native/src/layout/node.rs b/native/src/layout/node.rs index ed1cd3da..fae6e330 100644 --- a/native/src/layout/node.rs +++ b/native/src/layout/node.rs @@ -54,7 +54,11 @@ impl Node { &self.children } - pub(crate) fn align( + /// Aligns item according to [`Align`] and [`Size`]. + /// + /// [`Align`]: ../enum.Align.html + /// [`Size`]: ../struct.Size.html + pub fn align( &mut self, horizontal_alignment: Align, vertical_alignment: Align, From b72bd0b2b5c9c2a5c3f508a13ad9578169046a36 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 14 Feb 2020 15:57:07 +0100 Subject: [PATCH 3/8] Add `bound` to `Node` constructor. --- native/src/layout/flex.rs | 1 + native/src/layout/node.rs | 10 +++++----- native/src/user_interface.rs | 2 +- native/src/widget/button.rs | 4 ++-- native/src/widget/container.rs | 5 ++--- native/src/widget/image.rs | 2 +- native/src/widget/progress_bar.rs | 2 +- native/src/widget/scrollable.rs | 2 +- native/src/widget/slider.rs | 2 +- native/src/widget/space.rs | 2 +- native/src/widget/svg.rs | 2 +- native/src/widget/text.rs | 2 +- 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) -> Self { + pub fn with_children(size: Size, bound: Size, children: Vec) -> 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( From ebe0d4f47ec644d4c91097763de0f9b02e5f9d8a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 14 Feb 2020 18:03:59 +0100 Subject: [PATCH 4/8] Fix custom widget example. --- examples/custom_widget/src/main.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/custom_widget/src/main.rs b/examples/custom_widget/src/main.rs index 0a570745..19615064 100644 --- a/examples/custom_widget/src/main.rs +++ b/examples/custom_widget/src/main.rs @@ -39,10 +39,13 @@ mod circle { _renderer: &Renderer, _limits: &layout::Limits, ) -> layout::Node { - layout::Node::new(Size::new( - f32::from(self.radius) * 2.0, - f32::from(self.radius) * 2.0, - )) + layout::Node::new( + Size::new( + f32::from(self.radius) * 2.0, + f32::from(self.radius) * 2.0, + ), + Size::ZERO, + ) } fn hash_layout(&self, state: &mut Hasher) { From 60b40fdc99647d77febaae1d483fc5642c4ba50d Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 14 Feb 2020 18:17:32 +0100 Subject: [PATCH 5/8] Fix examples. --- examples/bezier_tool/src/main.rs | 2 +- examples/geometry/src/main.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index 043d265c..a08ea57c 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -84,7 +84,7 @@ mod bezier { .height(Length::Fill) .width(Length::Fill) .resolve(Size::ZERO); - layout::Node::new(size) + layout::Node::new(size, Size::ZERO) } fn draw( diff --git a/examples/geometry/src/main.rs b/examples/geometry/src/main.rs index 9d5fd611..2c9042f0 100644 --- a/examples/geometry/src/main.rs +++ b/examples/geometry/src/main.rs @@ -43,7 +43,7 @@ mod rainbow { ) -> layout::Node { let size = limits.width(Length::Fill).resolve(Size::ZERO); - layout::Node::new(Size::new(size.width, size.width)) + layout::Node::new(Size::new(size.width, size.width), Size::ZERO) } fn hash_layout(&self, _state: &mut Hasher) {} From f4b8bce837513cdd06df3a3ceba86fd9256d3cc5 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 14 Feb 2020 21:41:35 +0100 Subject: [PATCH 6/8] Revert changing the constructor and implement new method. --- examples/bezier_tool/src/main.rs | 2 +- examples/custom_widget/src/main.rs | 11 ++++------- examples/geometry/src/main.rs | 2 +- native/src/layout/flex.rs | 6 ++---- native/src/layout/node.rs | 22 +++++++++++++++------- native/src/user_interface.rs | 2 +- native/src/widget/button.rs | 8 +++----- native/src/widget/container.rs | 4 ++-- native/src/widget/image.rs | 2 +- native/src/widget/progress_bar.rs | 2 +- native/src/widget/scrollable.rs | 2 +- native/src/widget/slider.rs | 2 +- native/src/widget/space.rs | 2 +- native/src/widget/svg.rs | 2 +- native/src/widget/text.rs | 2 +- native/src/widget/text_input.rs | 12 +++--------- 16 files changed, 39 insertions(+), 44 deletions(-) diff --git a/examples/bezier_tool/src/main.rs b/examples/bezier_tool/src/main.rs index a08ea57c..043d265c 100644 --- a/examples/bezier_tool/src/main.rs +++ b/examples/bezier_tool/src/main.rs @@ -84,7 +84,7 @@ mod bezier { .height(Length::Fill) .width(Length::Fill) .resolve(Size::ZERO); - layout::Node::new(size, Size::ZERO) + layout::Node::new(size) } fn draw( diff --git a/examples/custom_widget/src/main.rs b/examples/custom_widget/src/main.rs index 19615064..0a570745 100644 --- a/examples/custom_widget/src/main.rs +++ b/examples/custom_widget/src/main.rs @@ -39,13 +39,10 @@ mod circle { _renderer: &Renderer, _limits: &layout::Limits, ) -> layout::Node { - layout::Node::new( - Size::new( - f32::from(self.radius) * 2.0, - f32::from(self.radius) * 2.0, - ), - Size::ZERO, - ) + layout::Node::new(Size::new( + f32::from(self.radius) * 2.0, + f32::from(self.radius) * 2.0, + )) } fn hash_layout(&self, state: &mut Hasher) { diff --git a/examples/geometry/src/main.rs b/examples/geometry/src/main.rs index 2c9042f0..9d5fd611 100644 --- a/examples/geometry/src/main.rs +++ b/examples/geometry/src/main.rs @@ -43,7 +43,7 @@ mod rainbow { ) -> layout::Node { let size = limits.width(Length::Fill).resolve(Size::ZERO); - layout::Node::new(Size::new(size.width, size.width), Size::ZERO) + layout::Node::new(Size::new(size.width, size.width)) } fn hash_layout(&self, _state: &mut Hasher) {} diff --git a/native/src/layout/flex.rs b/native/src/layout/flex.rs index 02037b14..2f65f1c1 100644 --- a/native/src/layout/flex.rs +++ b/native/src/layout/flex.rs @@ -18,7 +18,7 @@ // limitations under the License. use crate::{ layout::{Limits, Node}, - Align, Element, Size, + Align, Element, Point, Size, }; /// The main axis of a flex layout. @@ -152,8 +152,7 @@ where let (x, y) = axis.pack(main, padding); - node.bounds.x = x; - node.bounds.y = y; + node.move_to(Point::new(x, y)); match axis { Axis::Horizontal => { @@ -174,7 +173,6 @@ 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 e9885725..777a57fb 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, } @@ -12,19 +12,19 @@ impl Node { /// /// [`Node`]: struct.Node.html /// [`Size`]: ../struct.Size.html - pub fn new(size: Size, bound: Size) -> Self { - Self::with_children(size, bound, Vec::new()) + pub fn new(size: Size) -> Self { + Self::with_children(size, 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, bound: Size, children: Vec) -> Self { + pub fn with_children(size: Size, children: Vec) -> Self { Node { bounds: Rectangle { - x: bound.width, - y: bound.height, + x: 0.0, + y: 0.0, width: size.width, height: size.height, }, @@ -84,4 +84,12 @@ impl Node { } } } + + /// Move item to [`Point`]. + /// + /// [`Point`]: ../struct.Point.html + pub fn move_to(&mut self, position: Point) { + self.bounds.x = position.x; + self.bounds.y = position.y; + } } diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index b8fe7848..08914bed 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::ZERO, Size::ZERO), + layout: layout::Node::new(Size::new(0.0, 0.0)), 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 73be4d49..f1d46936 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, Size, Widget, + Rectangle, Widget, }; use std::hash::Hash; @@ -168,13 +168,11 @@ 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); - layout::Node::with_children(size, Size::ZERO, vec![content]) + layout::Node::with_children(size, vec![content]) } fn on_event( diff --git a/native/src/widget/container.rs b/native/src/widget/container.rs index d2065234..07bb62c6 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, Size, Element, Event, Hasher, Layout, Length, Point, + layout, Align, Clipboard, Element, Event, Hasher, Layout, Length, Point, Rectangle, Widget, }; @@ -148,7 +148,7 @@ where content.align(self.horizontal_alignment, self.vertical_alignment, size); - layout::Node::with_children(size, Size::ZERO, vec![content]) + layout::Node::with_children(size, vec![content]) } fn on_event( diff --git a/native/src/widget/image.rs b/native/src/widget/image.rs index 6938f5d5..200401f9 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, Size::ZERO) + layout::Node::new(size) } fn draw( diff --git a/native/src/widget/progress_bar.rs b/native/src/widget/progress_bar.rs index d011cc8a..67d1ab83 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, Size::ZERO) + layout::Node::new(size) } fn draw( diff --git a/native/src/widget/scrollable.rs b/native/src/widget/scrollable.rs index 6408a3d2..e83f25af 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, Size::ZERO, vec![content]) + layout::Node::with_children(size, vec![content]) } fn on_event( diff --git a/native/src/widget/slider.rs b/native/src/widget/slider.rs index c554fb9e..008203fe 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, Size::ZERO) + layout::Node::new(size) } fn on_event( diff --git a/native/src/widget/space.rs b/native/src/widget/space.rs index 899c258e..24c94bf6 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), Size::ZERO) + layout::Node::new(limits.resolve(Size::ZERO)) } fn draw( diff --git a/native/src/widget/svg.rs b/native/src/widget/svg.rs index 60d403ef..063730bb 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, Size::ZERO) + layout::Node::new(size) } fn draw( diff --git a/native/src/widget/text.rs b/native/src/widget/text.rs index ef8a9dbc..e4490fb6 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, Size::ZERO) + layout::Node::new(size) } fn draw( diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index 42aa3d69..c068b895 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -183,16 +183,10 @@ where .max_width(self.max_width) .height(Length::Units(text_size)); - let mut text = - layout::Node::new(limits.resolve(Size::ZERO), Size::ZERO); - text.bounds.x = padding; - text.bounds.y = padding; + let mut text = layout::Node::new(limits.resolve(Size::ZERO)); + text.move_to(Point::new(padding, padding)); - layout::Node::with_children( - text.size().pad(padding), - Size::ZERO, - vec![text], - ) + layout::Node::with_children(text.size().pad(padding), vec![text]) } fn on_event( From ddceb295f43154543b7f90bbd84964ede0901dbd Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 14 Feb 2020 21:43:34 +0100 Subject: [PATCH 7/8] Revert rustfmt change. --- native/src/widget/container.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/native/src/widget/container.rs b/native/src/widget/container.rs index 07bb62c6..3459a832 100644 --- a/native/src/widget/container.rs +++ b/native/src/widget/container.rs @@ -77,6 +77,7 @@ where self.max_height = max_height; self } + /// Sets the content alignment for the horizontal axis of the [`Container`]. /// /// [`Container`]: struct.Container.html From 8f83c805b15230a2f35002cfff88d9653ee08690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Fri, 14 Feb 2020 23:23:45 +0100 Subject: [PATCH 8/8] Improve documentation for new `Node` methods --- native/src/layout/node.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/native/src/layout/node.rs b/native/src/layout/node.rs index 777a57fb..11e93b72 100644 --- a/native/src/layout/node.rs +++ b/native/src/layout/node.rs @@ -54,10 +54,9 @@ impl Node { &self.children } - /// Aligns item according to [`Align`] and [`Size`]. - /// - /// [`Align`]: ../enum.Align.html - /// [`Size`]: ../struct.Size.html + /// Aligns the [`Node`] in the given space. + /// + /// [`Node`]: struct.Node.html pub fn align( &mut self, horizontal_alignment: Align, @@ -85,9 +84,9 @@ impl Node { } } - /// Move item to [`Point`]. + /// Moves the [`Node`] to the given position. /// - /// [`Point`]: ../struct.Point.html + /// [`Node`]: struct.Node.html pub fn move_to(&mut self, position: Point) { self.bounds.x = position.x; self.bounds.y = position.y;