summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-08-06 18:06:42 +0200
committerLibravatar GitHub <noreply@github.com>2024-08-06 18:06:42 +0200
commitd5ffe98ce939990e6c8ef6f40895cd1f9633fe18 (patch)
treece165aa5f79750b1fe4d05f7380a92759014cef6 /core
parentff0da4dc819a0cb3037502fd2ee82609f25f2fe9 (diff)
parent6fbbc30f5cb1f699c61e064ed54fe428d96be7d3 (diff)
downloadiced-d5ffe98ce939990e6c8ef6f40895cd1f9633fe18.tar.gz
iced-d5ffe98ce939990e6c8ef6f40895cd1f9633fe18.tar.bz2
iced-d5ffe98ce939990e6c8ef6f40895cd1f9633fe18.zip
Merge pull request #2539 from iced-rs/feature/row-wrapping
Implement `row::Wrapping` widget
Diffstat (limited to 'core')
-rw-r--r--core/src/layout/node.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/src/layout/node.rs b/core/src/layout/node.rs
index 5743a9bd..0c0f90fb 100644
--- a/core/src/layout/node.rs
+++ b/core/src/layout/node.rs
@@ -103,12 +103,13 @@ impl Node {
}
/// Translates the [`Node`] by the given translation.
- pub fn translate(self, translation: impl Into<Vector>) -> Self {
- let translation = translation.into();
+ pub fn translate(mut self, translation: impl Into<Vector>) -> Self {
+ self.translate_mut(translation);
+ self
+ }
- Self {
- bounds: self.bounds + translation,
- ..self
- }
+ /// Translates the [`Node`] by the given translation.
+ pub fn translate_mut(&mut self, translation: impl Into<Vector>) {
+ self.bounds = self.bounds + translation.into();
}
}