UI cleanups
This commit is contained in:
@@ -48,6 +48,7 @@ impl PopupManager {
|
|||||||
window_size.y * 0.5 - 100.0,
|
window_size.y * 0.5 - 100.0,
|
||||||
))
|
))
|
||||||
.show(ctx, |ui| {
|
.show(ctx, |ui| {
|
||||||
|
ui.set_height(50.0);
|
||||||
ui.vertical_centered(|ui| {
|
ui.vertical_centered(|ui| {
|
||||||
ui.heading(popup.title.clone());
|
ui.heading(popup.title.clone());
|
||||||
});
|
});
|
||||||
@@ -95,7 +96,6 @@ impl Popup {
|
|||||||
|
|
||||||
Self::new_with_id(id, title, move |_app, ui| {
|
Self::new_with_id(id, title, move |_app, ui| {
|
||||||
let mut close = false;
|
let mut close = false;
|
||||||
ui.set_height(50.0);
|
|
||||||
ui.centered_and_justified(|ui| {
|
ui.centered_and_justified(|ui| {
|
||||||
Grid::new(id.with("grid")).num_columns(2).show(ui, |ui| {
|
Grid::new(id.with("grid")).num_columns(2).show(ui, |ui| {
|
||||||
ui.label(RichText::new(icon.as_char()).size(30.0).color(icon.color()));
|
ui.label(RichText::new(icon.as_char()).size(30.0).color(icon.color()));
|
||||||
|
@@ -22,11 +22,11 @@ pub fn ui(app: &mut App, ui: &mut Ui, _ctx: &Context) {
|
|||||||
});
|
});
|
||||||
ui.end_row();
|
ui.end_row();
|
||||||
|
|
||||||
ui.label("Platform Size");
|
ui.label("Platform Size (mm)");
|
||||||
vec3_dragger(ui, app.slice_config.platform_size.as_mut(), |x| x);
|
vec3_dragger(ui, app.slice_config.platform_size.as_mut(), |x| x);
|
||||||
ui.end_row();
|
ui.end_row();
|
||||||
|
|
||||||
ui.label("Slice Height");
|
ui.label("Slice Height (mm)");
|
||||||
ui.add(DragValue::new(&mut app.slice_config.slice_height));
|
ui.add(DragValue::new(&mut app.slice_config.slice_height));
|
||||||
ui.end_row();
|
ui.end_row();
|
||||||
|
|
||||||
|
@@ -14,6 +14,7 @@ use crate::app::App;
|
|||||||
const IMPORT_MODEL_SHORTCUT: KeyboardShortcut = KeyboardShortcut::new(Modifiers::CTRL, Key::I);
|
const IMPORT_MODEL_SHORTCUT: KeyboardShortcut = KeyboardShortcut::new(Modifiers::CTRL, Key::I);
|
||||||
const LOAD_TEAPOT_SHORTCUT: KeyboardShortcut = KeyboardShortcut::new(Modifiers::CTRL, Key::T);
|
const LOAD_TEAPOT_SHORTCUT: KeyboardShortcut = KeyboardShortcut::new(Modifiers::CTRL, Key::T);
|
||||||
const QUIT_SHORTCUT: KeyboardShortcut = KeyboardShortcut::new(Modifiers::CTRL, Key::Q);
|
const QUIT_SHORTCUT: KeyboardShortcut = KeyboardShortcut::new(Modifiers::CTRL, Key::Q);
|
||||||
|
const SLICE_SHORTCUT: KeyboardShortcut = KeyboardShortcut::new(Modifiers::CTRL, Key::R);
|
||||||
|
|
||||||
pub fn ui(app: &mut App, ctx: &Context) {
|
pub fn ui(app: &mut App, ctx: &Context) {
|
||||||
ctx.input_mut(|x| x.consume_shortcut(&IMPORT_MODEL_SHORTCUT))
|
ctx.input_mut(|x| x.consume_shortcut(&IMPORT_MODEL_SHORTCUT))
|
||||||
@@ -22,6 +23,8 @@ pub fn ui(app: &mut App, ctx: &Context) {
|
|||||||
.then(|| import_teapot(app));
|
.then(|| import_teapot(app));
|
||||||
ctx.input_mut(|x| x.consume_shortcut(&QUIT_SHORTCUT))
|
ctx.input_mut(|x| x.consume_shortcut(&QUIT_SHORTCUT))
|
||||||
.then(|| quit());
|
.then(|| quit());
|
||||||
|
ctx.input_mut(|x| x.consume_shortcut(&SLICE_SHORTCUT))
|
||||||
|
.then(|| app.slice());
|
||||||
|
|
||||||
TopBottomPanel::top("top_panel").show(ctx, |ui| {
|
TopBottomPanel::top("top_panel").show(ctx, |ui| {
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
@@ -61,9 +64,11 @@ pub fn ui(app: &mut App, ctx: &Context) {
|
|||||||
None => false,
|
None => false,
|
||||||
};
|
};
|
||||||
ui.add_enabled_ui(!slicing, |ui| {
|
ui.add_enabled_ui(!slicing, |ui| {
|
||||||
ui.button(concatcp!(STACK, " Slice"))
|
let slice_button = ui.add(
|
||||||
.clicked()
|
Button::new(concatcp!(STACK, " Slice"))
|
||||||
.then(|| app.slice());
|
.shortcut_text(ctx.format_shortcut(&SLICE_SHORTCUT)),
|
||||||
|
);
|
||||||
|
slice_button.clicked().then(|| app.slice());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user