diff options
author | 2024-08-06 03:19:27 +0200 | |
---|---|---|
committer | 2024-08-06 03:22:44 +0200 | |
commit | 6fbbc30f5cb1f699c61e064ed54fe428d96be7d3 (patch) | |
tree | ce165aa5f79750b1fe4d05f7380a92759014cef6 /core | |
parent | ff0da4dc819a0cb3037502fd2ee82609f25f2fe9 (diff) | |
download | iced-6fbbc30f5cb1f699c61e064ed54fe428d96be7d3.tar.gz iced-6fbbc30f5cb1f699c61e064ed54fe428d96be7d3.tar.bz2 iced-6fbbc30f5cb1f699c61e064ed54fe428d96be7d3.zip |
Implement `row::Wrapping` widget
If you have a `Row`, simply call `Row::wrap` at
the end to turn it into a `Row` that will wrap its
contents.
The original alignment of the `Row` is preserved
per row wrapped.
Diffstat (limited to '')
-rw-r--r-- | core/src/layout/node.rs | 13 |
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(); } } |