fix: Row now restores previous X position

This patch fixes a bug that's extremely similar to the bug fixed by the
commit before this.
This commit is contained in:
TheOddGarlic 2022-05-01 18:35:01 +03:00
parent 88f518f7c1
commit b3aab25989
2 changed files with 4 additions and 1 deletions

View file

@ -29,7 +29,7 @@ impl Widget for Column {
); );
}); });
renderer.position_at(renderer.position().0, prev_y); renderer.position_at(renderer.position().0, prev_y)
} }
fn position(&self, renderer: &mut Renderer) -> Position { fn position(&self, renderer: &mut Renderer) -> Position {

View file

@ -15,6 +15,7 @@ pub struct Row {
impl Widget for Row { impl Widget for Row {
fn draw(&self, renderer: &mut Renderer) { fn draw(&self, renderer: &mut Renderer) {
let (prev_x, _) = renderer.position();
self.widgets.iter().for_each(|widget| { self.widgets.iter().for_each(|widget| {
let pos = widget.position(renderer); let pos = widget.position(renderer);
renderer.position_at( renderer.position_at(
@ -27,6 +28,8 @@ impl Widget for Row {
renderer.position().1 renderer.position().1
); );
}); });
renderer.position_at(prev_x, renderer.position().1)
} }
fn position(&self, renderer: &mut Renderer) -> Position { fn position(&self, renderer: &mut Renderer) -> Position {