From 4d5b17275a9ef845e20254027a020b07e586dc28 Mon Sep 17 00:00:00 2001 From: ElicMagus Date: Thu, 23 Mar 2023 15:55:16 +0300 Subject: [PATCH] Fix frame color, fix close button --- .vscode/launch.json | 1 + src/main.rs | 32 +++++++++++++++++++------------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 10efcb2..de6a0e8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,7 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { "type": "lldb", "request": "launch", diff --git a/src/main.rs b/src/main.rs index cb7ad27..0f3fbc3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -146,7 +146,7 @@ fn main() { ..Default::default() }) }), - ); + ).unwrap(); } #[derive(Default)] @@ -162,9 +162,10 @@ struct MyApp { } impl eframe::App for MyApp { - //fn clear_color(&self, _visuals: &egui::Visuals) -> egui::Rgba { - // egui::Rgba::TRANSPARENT // Make sure we don't paint anything behind the rounded corners - //} + fn clear_color(&self, _visuals: &egui::Visuals) -> [f32; 4] { + [0.0f32; 4] // Make sure we don't paint anything behind the rounded corners + // egui::Rgba::TRANSPARENT; + } fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) { let (tx, rx): (Sender, Receiver) = mpsc::channel(); @@ -219,10 +220,14 @@ impl eframe::App for MyApp { // println!("Update"); self.connect_screen(ui, tx, rx) } + ScreenCurrent::CalibrationStend => { + + }, _ => (), } }); } + } impl MyApp { @@ -363,15 +368,6 @@ fn custom_window_frame( Stroke::new(1.0, text_color), ); - // Add the close button: - let close_response = ui.put( - Rect::from_min_size(rect.right_top() - vec2(height, 0.0), Vec2::splat(height)), - Button::new(RichText::new("❌").size(height - 4.0)).frame(false), - ); - if close_response.clicked() { - frame.close(); - } - // Interact with the title bar (drag to move window): let title_bar_rect = { let mut rect = rect; @@ -384,6 +380,16 @@ fn custom_window_frame( frame.drag_window(); } + + // Add the close button: + let close_response = ui.put( + Rect::from_min_size(rect.right_top() - vec2(height, 0.0), Vec2::splat(height)), + Button::new(RichText::new("❌").size(height-4.0)).frame(false), + ); + if close_response.clicked() { + frame.close(); + } + // Add the contents: let content_rect = { let mut rect = rect;