summaryrefslogtreecommitdiffstats
path: root/native
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-12-13 17:46:39 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-12-13 17:46:39 +0700
commit48b2264bc6026e4b4b00791fef5ce34d464abc17 (patch)
tree66cfb84f5efea0407a8022ed6522ef74f742bf7a /native
parenta92307890fcc3a567ec3d1b1cffebb59ae98991e (diff)
downloadiced-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.rs10
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
+ }
+ }
}