fix: Column now restores previous Y position

This patch fixes the bug where positioning is all wonky after having
rendered a Column, because Column didn't restore the previous Y
position. Similar bugs probably will occur but this is the first one I
catched.
master
TheOddGarlic 2022-05-01 18:29:36 +03:00
parent 3c5c57cf22
commit 88f518f7c1
1 changed files with 3 additions and 0 deletions

View File

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