/// The system that shows the Miratope library.
The system that shows the Miratope library.
The system that shows the Miratope library .
fn show_library(
    egui_ctx: Res<'_, EguiContext>,
    mut query: Query<'_, '_, &mut Concrete>,
    mut library: ResMut<'_, Option<Library>>,
    lib_path: Res<'_, LibPath>,
) {
    // Shows the polytope library.
    if let Some(library) = library.as_mut() {
        egui::SidePanel::left("side_panel")
            .default_width(350.0)
            .max_width(450.0)
            .show(egui_ctx.ctx(), |ui| {
                egui::containers::ScrollArea::auto_sized().show(ui, |ui| {
                    match library.show(ui, PathBuf::from(lib_path.as_ref())) {
                        // No action needs to be taken.
                        ShowResult::None => {}
                        // Loads a selected file.
                        ShowResult::Load(file) => match Concrete::from_path(&file) {
                            Ok(q) => *query.iter_mut().next().unwrap() = q,
                            Err(err) => eprintln!("File open failed: {}", err),
                        },
                        // Loads a special polytope.
                        ShowResult::Special(special) => {
                            *query.iter_mut().next().unwrap() = special.load()
                        }
                    }
                })
            });
    }
}
fn show_library ( egui_ctx : Res < ' _ , EguiContext > , mut query : Query < ' _ , ' _ , & mut Concrete > , mut library : ResMut < ' _ , Option < Library > > , lib_path : Res < ' _ , LibPath > , ) { // Shows the polytope library. if let Some ( library ) = library . as_mut ( ) { egui :: SidePanel :: left ( " " ) . default_width ( 350.0 ) . max_width ( 450.0 ) . show ( egui_ctx . ctx ( ) , | ui | { egui :: containers :: ScrollArea :: auto_sized ( ) . show ( ui , | ui | { match library . show ( ui , PathBuf :: from ( lib_path . as_ref ( ) ) ) { // No action needs to be taken. ShowResult :: None => { } // Loads a selected file. ShowResult :: Load ( file ) => match Concrete :: from_path ( & file ) { Ok ( q ) => * query . iter_mut ( ) . next ( ) . unwrap ( ) = q , Err ( err ) => eprintln ! ( " " err ) , } , // Loads a special polytope. ShowResult :: Special ( special ) => { * query . iter_mut ( ) . next ( ) . unwrap ( ) = special . load ( ) } } } ) } ) ; } }
The system that shows the Miratope library.
The system that shows the Miratope library .
egui_ctx
Res<'_, EguiContext>
query
Query<'_, '_, &mut Concrete>
library
ResMut<'_, Option<Library>>
lib_path
Res<'_, LibPath>