From 1883041ef96d4b442f95a3230c360cae690bc52f Mon Sep 17 00:00:00 2001 From: Miika Alikirri Date: Wed, 1 Feb 2023 14:34:07 +0200 Subject: [PATCH] Added a simple link for returning to home page --- src/gui/yle_image.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gui/yle_image.rs b/src/gui/yle_image.rs index 9002c06..cd24e53 100644 --- a/src/gui/yle_image.rs +++ b/src/gui/yle_image.rs @@ -173,6 +173,16 @@ impl<'a> GuiYleImage<'a> { }); } + fn draw_home_button(&mut self) { + let ctx = &self.ctx; + self.ui + .with_layout(egui::Layout::top_down(egui::Align::Center), |ui| { + if ui.link("Yle Teksti-TV").clicked() { + ctx.borrow_mut().load_page("100_0001", true); + } + }); + } + fn draw_page_navigation(&mut self, navigation: &[Option]) { if self.is_small { self.draw_page_navigation_small(navigation); @@ -192,6 +202,7 @@ impl<'a> PageDraw<'a, YleImage> for GuiYleImage<'a> { self.draw_header(&page.title); self.draw_image(&page.image, &page.image_map); self.draw_page_navigation(&page.botton_navigation); + self.draw_home_button(); } FetchState::Fetching => { self.ui