mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 22:30:03 -04:00
Enable and fix a bunch more lints
This commit is contained in:
@@ -8,12 +8,10 @@ mod wrap_app;
|
||||
pub use wrap_app::WrapApp;
|
||||
|
||||
/// Time of day as seconds since midnight. Used for clock in demo app.
|
||||
pub(crate) fn seconds_since_midnight() -> Option<f64> {
|
||||
pub(crate) fn seconds_since_midnight() -> f64 {
|
||||
use chrono::Timelike;
|
||||
let time = chrono::Local::now().time();
|
||||
let seconds_since_midnight =
|
||||
time.num_seconds_from_midnight() as f64 + 1e-9 * (time.nanosecond() as f64);
|
||||
Some(seconds_since_midnight)
|
||||
time.num_seconds_from_midnight() as f64 + 1e-9 * (time.nanosecond() as f64)
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
@@ -42,7 +42,8 @@ impl eframe::App for FractalClockApp {
|
||||
egui::CentralPanel::default()
|
||||
.frame(egui::Frame::dark_canvas(&ctx.style()))
|
||||
.show(ctx, |ui| {
|
||||
self.fractal_clock.ui(ui, crate::seconds_since_midnight());
|
||||
self.fractal_clock
|
||||
.ui(ui, Some(crate::seconds_since_midnight()));
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -287,12 +288,10 @@ impl WrapApp {
|
||||
ui.with_layout(egui::Layout::right_to_left(), |ui| {
|
||||
if false {
|
||||
// TODO(emilk): fix the overlap on small screens
|
||||
if let Some(seconds_since_midnight) = crate::seconds_since_midnight() {
|
||||
if clock_button(ui, seconds_since_midnight).clicked() {
|
||||
self.state.selected_anchor = "clock".to_owned();
|
||||
if frame.is_web() {
|
||||
ui.output().open_url("#clock");
|
||||
}
|
||||
if clock_button(ui, crate::seconds_since_midnight()).clicked() {
|
||||
self.state.selected_anchor = "clock".to_owned();
|
||||
if frame.is_web() {
|
||||
ui.output().open_url("#clock");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user