From b3aab259894f0b426db6d5de21079ca8d398fbab Mon Sep 17 00:00:00 2001 From: TheOddGarlic Date: Sun, 1 May 2022 18:35:01 +0300 Subject: [PATCH] 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. --- src/widget/column.rs | 2 +- src/widget/row.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/widget/column.rs b/src/widget/column.rs index 5a22985..2029091 100755 --- a/src/widget/column.rs +++ b/src/widget/column.rs @@ -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 { diff --git a/src/widget/row.rs b/src/widget/row.rs index 95473e5..a5dbc2f 100755 --- a/src/widget/row.rs +++ b/src/widget/row.rs @@ -15,6 +15,7 @@ pub struct Row { impl Widget for Row { fn draw(&self, renderer: &mut Renderer) { + let (prev_x, _) = renderer.position(); self.widgets.iter().for_each(|widget| { let pos = widget.position(renderer); renderer.position_at( @@ -27,6 +28,8 @@ impl Widget for Row { renderer.position().1 ); }); + + renderer.position_at(prev_x, renderer.position().1) } fn position(&self, renderer: &mut Renderer) -> Position {