fix: proper ui sizing

This commit is contained in:
əlemi 2022-11-07 01:36:57 +01:00
parent fc6926816b
commit 2e38a00583
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 8 additions and 7 deletions

View file

@ -23,17 +23,17 @@ pub fn metric_edit_ui(ui: &mut Ui, metric: &entities::metrics::Model) {
ui.horizontal(|ui| { ui.horizontal(|ui| {
// ui.color_edit_button_srgba(&mut unpack_color(metric.color)); // ui.color_edit_button_srgba(&mut unpack_color(metric.color));
color_square(ui, unpack_color(metric.color)); color_square(ui, unpack_color(metric.color));
let available = ui.available_width() - 79.0; let unit = (ui.available_width() - 65.0) / 5.0;
TextEdit::singleline(&mut name) TextEdit::singleline(&mut name)
.desired_width(available / 2.0) .desired_width(unit * 2.0)
.interactive(false) .interactive(false)
.hint_text("name") .hint_text("name")
.show(ui); .show(ui);
ui.separator(); ui.separator();
TextEdit::singleline(&mut query) TextEdit::singleline(&mut query)
.desired_width(available / 2.0) .desired_width(unit * 3.0)
.interactive(false) .interactive(false)
.hint_text("y") .hint_text("query")
.show(ui); .show(ui);
}); });
} }

View file

@ -296,14 +296,15 @@ pub fn header(app: &mut App, ui: &mut Ui, frame: &mut Frame) {
if !last_edit { // TODO kinda cheap fix having it down here if !last_edit { // TODO kinda cheap fix having it down here
app.panels = app.view.panels.borrow().clone(); app.panels = app.view.panels.borrow().clone();
} }
if ui.button("+").clicked() {
app.editing.push(entities::panels::Model::default().into());
}
if ui.button("reset").clicked() { if ui.button("reset").clicked() {
app.panels = app.view.panels.borrow().clone(); app.panels = app.view.panels.borrow().clone();
} }
if ui.button("save").clicked() { if ui.button("save").clicked() {
app.save_all_panels(); app.save_all_panels();
} app.edit = false;
if ui.button("+").clicked() {
app.editing.push(entities::panels::Model::default().into());
} }
} }
ui.separator(); ui.separator();