diff options
author | 2021-12-13 17:46:39 +0700 | |
---|---|---|
committer | 2021-12-13 17:46:39 +0700 | |
commit | 48b2264bc6026e4b4b00791fef5ce34d464abc17 (patch) | |
tree | 66cfb84f5efea0407a8022ed6522ef74f742bf7a /native | |
parent | a92307890fcc3a567ec3d1b1cffebb59ae98991e (diff) | |
download | iced-48b2264bc6026e4b4b00791fef5ce34d464abc17.tar.gz iced-48b2264bc6026e4b4b00791fef5ce34d464abc17.tar.bz2 iced-48b2264bc6026e4b4b00791fef5ce34d464abc17.zip |
Simplify `component` implementation in `iced_lazy`
Diffstat (limited to 'native')
-rw-r--r-- | native/src/layout/node.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/native/src/layout/node.rs b/native/src/layout/node.rs index e9e6058e..e0c7dcb2 100644 --- a/native/src/layout/node.rs +++ b/native/src/layout/node.rs @@ -1,4 +1,4 @@ -use crate::{Alignment, Point, Rectangle, Size}; +use crate::{Alignment, Point, Rectangle, Size, Vector}; /// The bounds of an element and its children. #[derive(Debug, Clone, Default)] @@ -80,4 +80,12 @@ impl Node { self.bounds.x = position.x; self.bounds.y = position.y; } + + /// Translates the [`Node`] by the given translation. + pub fn translate(self, translation: Vector) -> Self { + Self { + bounds: self.bounds + translation, + ..self + } + } } |