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.
This commit is contained in:
Héctor Ramón Jiménez 2024-08-06 03:19:27 +02:00
parent ff0da4dc81
commit 6fbbc30f5c
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
3 changed files with 211 additions and 9 deletions

View file

@ -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();
}
}