File tree Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Expand file tree Collapse file tree 1 file changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -62,19 +62,21 @@ impl eframe::App for DemoApp {
62
62
63
63
ui. label ( egui:: RichText :: new ( "Examples" ) . monospace ( ) ) ;
64
64
ui. with_layout ( egui:: Layout :: top_down_justified ( egui:: Align :: LEFT ) , |ui| {
65
- for ( idx, example) in self . examples . iter ( ) . enumerate ( ) {
66
- let is_open = self
67
- . open_example_idx
68
- . is_some_and ( |open_idx| open_idx == idx) ;
69
-
70
- if ui. selectable_label ( is_open, example. title ( ) ) . clicked ( ) {
71
- if is_open {
72
- self . open_example_idx = None ;
73
- } else {
74
- self . open_example_idx = Some ( idx) ;
65
+ egui:: ScrollArea :: vertical ( ) . show ( ui, |ui| {
66
+ for ( idx, example) in self . examples . iter ( ) . enumerate ( ) {
67
+ let is_open = self
68
+ . open_example_idx
69
+ . is_some_and ( |open_idx| open_idx == idx) ;
70
+
71
+ if ui. selectable_label ( is_open, example. title ( ) ) . clicked ( ) {
72
+ if is_open {
73
+ self . open_example_idx = None ;
74
+ } else {
75
+ self . open_example_idx = Some ( idx) ;
76
+ }
75
77
}
76
78
}
77
- }
79
+ } ) ;
78
80
} ) ;
79
81
} ) ;
80
82
@@ -98,7 +100,9 @@ impl eframe::App for DemoApp {
98
100
egui:: CentralPanel :: default ( ) . show ( ctx, |ui| {
99
101
match example {
100
102
Some ( example) => {
101
- example. show ( ui) ;
103
+ egui:: ScrollArea :: vertical ( ) . show ( ui, |ui| {
104
+ example. show ( ui) ;
105
+ } ) ;
102
106
}
103
107
None => {
104
108
if !self . left_sidebar_expanded {
You can’t perform that action at this time.
0 commit comments