File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ impl WrappingExample {
20
20
wrap : JsonTreeWrapping {
21
21
max_rows : 1 ,
22
22
max_width : JsonTreeMaxWidth :: UiAvailableWidth ,
23
+ break_anywhere : true ,
23
24
} ,
24
25
use_maximum_max_rows : false ,
25
26
}
@@ -59,6 +60,7 @@ impl Show for WrappingExample {
59
60
{
60
61
self . wrap . max_rows = usize:: MAX ;
61
62
}
63
+ ui. add_space ( 10.0 ) ;
62
64
63
65
ui. label ( egui:: RichText :: new ( "Max Width:" ) . monospace ( ) ) ;
64
66
ui. horizontal ( |ui| {
@@ -86,6 +88,13 @@ impl Show for WrappingExample {
86
88
{
87
89
self . wrap . max_width = JsonTreeMaxWidth :: UiAvailableWidth ;
88
90
}
91
+ ui. add_space ( 10.0 ) ;
92
+
93
+ ui. horizontal ( |ui| {
94
+ ui. label ( egui:: RichText :: new ( "Break anywhere:" ) . monospace ( ) ) ;
95
+ ui. checkbox ( & mut self . wrap . break_anywhere , "" ) ;
96
+ } ) ;
97
+ ui. separator ( ) ;
89
98
90
99
JsonTree :: new ( self . title ( ) , & self . value )
91
100
. style ( JsonTreeStyle :: new ( ) . wrap ( JsonTreeWrappingParams {
Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ impl JsonTreeStyle {
92
92
egui:: text:: TextWrapping {
93
93
max_width,
94
94
max_rows : wrap. max_rows ,
95
+ break_anywhere : wrap. break_anywhere ,
95
96
..Default :: default ( )
96
97
}
97
98
}
@@ -161,6 +162,7 @@ pub struct JsonTreeWrappingParams {
161
162
pub struct JsonTreeWrapping {
162
163
pub max_rows : usize ,
163
164
pub max_width : JsonTreeMaxWidth ,
165
+ pub break_anywhere : bool ,
164
166
}
165
167
166
168
impl Default for JsonTreeWrapping {
@@ -170,6 +172,7 @@ impl Default for JsonTreeWrapping {
170
172
Self {
171
173
max_rows : usize:: MAX ,
172
174
max_width : JsonTreeMaxWidth :: UiAvailableWidth ,
175
+ break_anywhere : false ,
173
176
}
174
177
}
175
178
}
You can’t perform that action at this time.
0 commit comments