@@ -6,6 +6,8 @@ const PANEL_CARD_INNER_MARGIN_X: i8 = 10;
66const PANEL_CARD_INNER_MARGIN_Y : i8 = 8 ;
77const SPLINE_KNOT_INPUTS_MAX_HEIGHT : f32 = 180.0 ;
88const RESULT_PARAMS_MAX_HEIGHT : f32 = 190.0 ;
9+ const COLLAPSING_ICON_SCALE : f32 = 1.5 ;
10+ const COLLAPSING_HEADER_TEXT_OFFSET_X : f32 = 4.0 ;
911const DIAGNOSTICS_SERIES_ID_LOSS : & str = "diagnostics_series_loss" ;
1012const DIAGNOSTICS_SERIES_ID_MSE : & str = "diagnostics_series_mse" ;
1113const DIAGNOSTICS_SERIES_ID_RMSE : & str = "diagnostics_series_rmse" ;
@@ -30,6 +32,39 @@ impl CurveFitApp {
3032 ) )
3133 }
3234
35+ pub ( super ) fn panel_card_collapsible (
36+ ui : & mut egui:: Ui ,
37+ id_salt : impl std:: hash:: Hash ,
38+ title : impl Into < egui:: WidgetText > ,
39+ add_body : impl FnOnce ( & mut egui:: Ui ) ,
40+ ) {
41+ Self :: panel_card_frame ( ui) . show ( ui, |ui| {
42+ ui. set_min_width ( ui. available_width ( ) ) ;
43+ ui. scope ( |ui| {
44+ ui. spacing_mut ( ) . indent += COLLAPSING_HEADER_TEXT_OFFSET_X ;
45+ egui:: CollapsingHeader :: new ( title. into ( ) . heading ( ) )
46+ . id_salt ( id_salt)
47+ . default_open ( true )
48+ . icon ( |ui, openness, response| {
49+ let enlarged_rect = egui:: Rect :: from_center_size (
50+ response. rect . center ( ) ,
51+ response. rect . size ( ) * COLLAPSING_ICON_SCALE ,
52+ )
53+ . translate ( egui:: vec2 ( -0.5 * COLLAPSING_HEADER_TEXT_OFFSET_X , 0.0 ) ) ;
54+ let enlarged_response = response. clone ( ) . with_new_rect ( enlarged_rect) ;
55+ egui:: containers:: collapsing_header:: paint_default_icon (
56+ ui,
57+ openness,
58+ & enlarged_response,
59+ ) ;
60+ } )
61+ . show_unindented ( ui, |ui| {
62+ add_body ( ui) ;
63+ } ) ;
64+ } ) ;
65+ } ) ;
66+ }
67+
3368 pub ( super ) fn action_button_style (
3469 ui : & egui:: Ui ,
3570 is_stop : bool ,
@@ -399,7 +434,6 @@ impl CurveFitApp {
399434 pub ( super ) fn ui_tools ( & mut self , ui : & mut egui:: Ui ) {
400435 let language = self . ui_language ;
401436 let icon_tint = ui. visuals ( ) . text_color ( ) ;
402- ui. heading ( tr ( language, "Tools" , "Инструменты" ) ) ;
403437 ui. label (
404438 egui:: RichText :: new ( tr (
405439 language,
@@ -508,7 +542,6 @@ impl CurveFitApp {
508542 parse_error_message,
509543 )
510544 } ;
511- ui. heading ( tr ( language, "Input Points" , "Точки" ) ) ;
512545 ui. label ( tr (
513546 language,
514547 "One point per line: x and y separated by space, tab, or ';'" ,
@@ -680,7 +713,6 @@ impl CurveFitApp {
680713 pub ( super ) fn ui_family_and_params ( & mut self , ui : & mut egui:: Ui ) {
681714 let language = self . ui_language ;
682715 let can_edit_params = !self . fit_in_progress ;
683- ui. heading ( tr ( language, "Model" , "Модель" ) ) ;
684716
685717 let previous_model = self . selected_model ;
686718 ui. add_enabled_ui ( can_edit_params, |ui| {
@@ -993,7 +1025,6 @@ impl CurveFitApp {
9931025 pub ( super ) fn ui_optimizer ( & mut self , ui : & mut egui:: Ui ) {
9941026 let language = self . ui_language ;
9951027 let icon_tint = ui. visuals ( ) . text_color ( ) ;
996- ui. heading ( tr ( language, "Optimizer" , "Оптимизатор" ) ) ;
9971028 egui:: ComboBox :: from_label ( tr ( language, "Method" , "Метод" ) )
9981029 . selected_text ( optimizer_method_label ( language, self . optimizer_method ) )
9991030 . show_ui ( ui, |ui| {
@@ -1296,7 +1327,6 @@ impl CurveFitApp {
12961327
12971328 pub ( super ) fn ui_optimization_metric ( & mut self , ui : & mut egui:: Ui ) {
12981329 let language = self . ui_language ;
1299- ui. heading ( tr ( language, "Optimization metric" , "Метрика оптимизации" ) ) ;
13001330 egui:: ComboBox :: from_label ( tr ( language, "Metric" , "Метрика" ) )
13011331 . selected_text ( optimization_loss_metric_label (
13021332 language,
@@ -1761,7 +1791,6 @@ impl CurveFitApp {
17611791
17621792 pub ( super ) fn ui_result ( & self , ui : & mut egui:: Ui ) {
17631793 let language = self . ui_language ;
1764- ui. heading ( tr ( language, "Result" , "Результат" ) ) ;
17651794 if self . fit_in_progress {
17661795 ui. label ( tr (
17671796 language,
0 commit comments