Skip to content

Commit

Permalink
center save button
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Spaink committed Aug 22, 2023
1 parent d5ed339 commit 678cf4e
Showing 1 changed file with 26 additions and 19 deletions.
45 changes: 26 additions & 19 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,31 +76,38 @@ impl eframe::App for App {
&assets.remove_thumb,
);

if ui.button(RichText::new("save").size(20.0)).clicked() {

let mut name: String = "".to_owned();

for (field_name, value) in ferris.iter() {
if let Some(string_opt) = value.downcast_ref::<Option<String>>() {
if let Some(string) = string_opt.as_deref() {
if field_name == "color" {
name += string;
} else {
name += &format!("_{}", string);
ui.vertical_centered_justified(|ui| {
if ui.button(RichText::new("save").size(30.0)).clicked() {

let mut name: String = "".to_owned();

for (field_name, value) in ferris.iter() {
if let Some(string_opt) = value.downcast_ref::<Option<String>>() {
if let Some(string) = string_opt.as_deref() {
if field_name == "color" {
name += string;
} else {
name += &format!("_{}", string);
}
}
}
}
}

ui.ctx().output_mut(|o| {
o.open_url = Some(egui::output::OpenUrl {
url: format!("https://raw.githubusercontent.com/sspaink/rustaceanize.me/master/pregen_crabs/{name}.png"),
new_tab: true,
ui.ctx().output_mut(|o| {
o.open_url = Some(egui::output::OpenUrl {
url: format!("https://raw.githubusercontent.com/sspaink/rustaceanize.me/master/pregen_crabs/{name}.png"),
new_tab: true,
});
});
});
}
}
});

ui.with_layout(egui::Layout::bottom_up(egui::Align::LEFT), |ui| {
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 0.0;
ui.label("Inspired by ");
ui.hyperlink_to("gopherize.me", "https://gopherize.me/");
});
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 0.0;
ui.label("Created by ");
Expand All @@ -126,7 +133,7 @@ fn display_thumbnails(
removable: bool,
remove_thumb: &RetainedImage,
) {
ui.collapsing(RichText::new(id).size(20.0), |ui| {
ui.collapsing(RichText::new(id).size(20.0).strong(), |ui| {
egui::Grid::new(id).show(ui, |ui| {
let mut current = 0;

Expand Down

0 comments on commit 678cf4e

Please sign in to comment.