Fix frame color, fix close button

master

@ -4,6 +4,7 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",

@ -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<u8>, Receiver<u8>) = 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;

Loading…
Cancel
Save