@@ -492,8 +492,10 @@ impl eframe::App for App {
492
492
493
493
self . run_pending_commands ( egui_ctx, frame) ;
494
494
495
- self . frame_time_history
496
- . add ( egui_ctx. input ( ) . time , frame_start. elapsed ( ) . as_secs_f32 ( ) ) ;
495
+ self . frame_time_history . add (
496
+ egui_ctx. input ( |i| i. time ) ,
497
+ frame_start. elapsed ( ) . as_secs_f32 ( ) ,
498
+ ) ;
497
499
}
498
500
}
499
501
@@ -667,7 +669,7 @@ impl App {
667
669
668
670
// Keep the style:
669
671
let style = egui_ctx. style ( ) ;
670
- * egui_ctx. memory ( ) = Default :: default ( ) ;
672
+ egui_ctx. memory_mut ( |mem| * mem = Default :: default ( ) ) ;
671
673
egui_ctx. set_style ( ( * style) . clone ( ) ) ;
672
674
}
673
675
@@ -684,13 +686,13 @@ impl App {
684
686
preview_files_being_dropped ( egui_ctx) ;
685
687
686
688
// Collect dropped files:
687
- if egui_ctx. input ( ) . raw . dropped_files . len ( ) > 2 {
689
+ if egui_ctx. input ( |i| i . raw . dropped_files . len ( ) ) > 2 {
688
690
rfd:: MessageDialog :: new ( )
689
691
. set_level ( rfd:: MessageLevel :: Error )
690
692
. set_description ( "Can only load one file at a time" )
691
693
. show ( ) ;
692
694
}
693
- if let Some ( file) = egui_ctx. input ( ) . raw . dropped_files . first ( ) {
695
+ if let Some ( file) = egui_ctx. input ( |i| i . raw . dropped_files . first ( ) . cloned ( ) ) {
694
696
if let Some ( bytes) = & file. bytes {
695
697
let mut bytes: & [ u8 ] = & ( * bytes) [ ..] ;
696
698
if let Some ( log_db) = load_file_contents ( & file. name , & mut bytes) {
@@ -715,22 +717,24 @@ fn preview_files_being_dropped(egui_ctx: &egui::Context) {
715
717
use egui:: { Align2 , Color32 , Id , LayerId , Order , TextStyle } ;
716
718
717
719
// Preview hovering files:
718
- if !egui_ctx. input ( ) . raw . hovered_files . is_empty ( ) {
720
+ if !egui_ctx. input ( |i| i . raw . hovered_files . is_empty ( ) ) {
719
721
use std:: fmt:: Write as _;
720
722
721
723
let mut text = "Drop to load:\n " . to_owned ( ) ;
722
- for file in & egui_ctx. input ( ) . raw . hovered_files {
723
- if let Some ( path) = & file. path {
724
- write ! ( text, "\n {}" , path. display( ) ) . ok ( ) ;
725
- } else if !file. mime . is_empty ( ) {
726
- write ! ( text, "\n {}" , file. mime) . ok ( ) ;
724
+ egui_ctx. input ( |input| {
725
+ for file in & input. raw . hovered_files {
726
+ if let Some ( path) = & file. path {
727
+ write ! ( text, "\n {}" , path. display( ) ) . ok ( ) ;
728
+ } else if !file. mime . is_empty ( ) {
729
+ write ! ( text, "\n {}" , file. mime) . ok ( ) ;
730
+ }
727
731
}
728
- }
732
+ } ) ;
729
733
730
734
let painter =
731
735
egui_ctx. layer_painter ( LayerId :: new ( Order :: Foreground , Id :: new ( "file_drop_target" ) ) ) ;
732
736
733
- let screen_rect = egui_ctx. input ( ) . screen_rect ( ) ;
737
+ let screen_rect = egui_ctx. screen_rect ( ) ;
734
738
painter. rect_filled ( screen_rect, 0.0 , Color32 :: from_black_alpha ( 192 ) ) ;
735
739
painter. text (
736
740
screen_rect. center ( ) ,
0 commit comments