How to scroll a content in egui rust

375 Views Asked by At

I have this particular egui application, I have declared my window and initial size and when my content is big or when its expanded and reaches end of the window I cannot scroll down and look at the contents, is there any way to implement scroll in egui rust


fn main() {
    let nativeoption = eframe::NativeOptions{...};
    eframe::run_native(
        "Portfolio",
        nativeoption,
        Box::new(|cc| Box::new(MyEguiApp::new(cc))),
    )
    .expect("TODO: panic message");
}
#[derive(Default)]
struct MyEguiApp {}

impl MyEguiApp {
    fn new(_cc: &eframe::CreationContext<'_>) -> Self {
        Self::default()
    }

    fn open_url(&self, url: &str) {
        if let Err(err) = webbrowser::open(url) {
            eprintln!("failed to open link {:?} ", err);
        }
    }
}
impl eframe::App for MyEguiApp {
    fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
        egui::CentralPanel::default().show(ctx,|ui| {
           if ui.interact(ui.max_rect(),Id::new("window-drag"),Sense::drag()).dragged() {
               frame.drag_window();
           }

           ui.heading("Hi! I am pretham Muthappa");

           ui.separator();
           ui.horizontal(|ui| {

        let _= ui.button("HOME");
       if ui.button("ABOUT").clicked() {
        self.open_url("https://tidersky.me");
        }

        if ui.button("RESUME").clicked() {
        self.open_url("https://drive.google.com/file/d/1jgWFzMDIrpW9odLQMoljTGtEeofRvf6W/view");
        }

        if ui.button("CONTACT").clicked() {

          self.open_url("https://tidersky.me")

       } });

               ui.separator();

              ui.heading("About");

              ui.label("Hello I am pretham muthappa , I am a final year computer science student. I like coding and creating open source projects and apart from coding i do pixel art illstration");

              ui.separator();
              ui.heading("project");

             egui::CollapsingHeader::new("SnapCrawler")
                 .show(ui,|ui| {
                     ui.label("Snapercrawler is a webscrapper tool built using Nodejs and puppeteer , it can scrape any images from most of the website and save it in a directory")
                 });

           egui::CollapsingHeader::new("Event-Hive")
               .show(ui,|ui| {
                   ui.label("Snapercrawler is a webscrapper tool built using ")
               });

           egui::CollapsingHeader::new("Geek-Notes")
               .show(ui,|ui| {
                   ui.label("Snapercrawler is a webscrapper tool built using ")
               });

           egui::CollapsingHeader::new("Vulkan-rust")
               .show(ui,|ui| {
                   ui.label("Snapercrawler is a webscrapper tool built using ")
               })

          });
    }
}


my output

enter image description here

as you can see , my content at the bottom moves down and i cannot scroll

0

There are 0 best solutions below