From 2e38a005831e9dadbb8d4634aaec6065ca96acde Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 7 Nov 2022 01:36:57 +0100 Subject: [PATCH] fix: proper ui sizing --- src/gui/metric.rs | 8 ++++---- src/gui/scaffold.rs | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gui/metric.rs b/src/gui/metric.rs index a58bb86..db06bd5 100644 --- a/src/gui/metric.rs +++ b/src/gui/metric.rs @@ -23,17 +23,17 @@ pub fn metric_edit_ui(ui: &mut Ui, metric: &entities::metrics::Model) { ui.horizontal(|ui| { // ui.color_edit_button_srgba(&mut 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) - .desired_width(available / 2.0) + .desired_width(unit * 2.0) .interactive(false) .hint_text("name") .show(ui); ui.separator(); TextEdit::singleline(&mut query) - .desired_width(available / 2.0) + .desired_width(unit * 3.0) .interactive(false) - .hint_text("y") + .hint_text("query") .show(ui); }); } diff --git a/src/gui/scaffold.rs b/src/gui/scaffold.rs index bb20364..e9d1665 100644 --- a/src/gui/scaffold.rs +++ b/src/gui/scaffold.rs @@ -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 app.panels = app.view.panels.borrow().clone(); } + if ui.button("+").clicked() { + app.editing.push(entities::panels::Model::default().into()); + } if ui.button("reset").clicked() { app.panels = app.view.panels.borrow().clone(); } if ui.button("save").clicked() { app.save_all_panels(); - } - if ui.button("+").clicked() { - app.editing.push(entities::panels::Model::default().into()); + app.edit = false; } } ui.separator();