Skip to content

Commit 099d0d6

Browse files
committed
remove deprecated ui.close_menu calls since now obselete as of egui 0.32
1 parent e2a21cb commit 099d0d6

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

examples/demo/src/apps/copy_to_clipboard.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use egui::{CursorIcon, Ui};
2-
use egui_json_tree::{render::DefaultRender, JsonTree};
2+
use egui_json_tree::{JsonTree, render::DefaultRender};
33
use serde_json::Value;
44

55
use super::Show;
@@ -34,15 +34,13 @@ impl Show for CopyToClipboardExample {
3434
if !pointer.is_empty() && ui.button("Copy path").clicked() {
3535
println!("{}", pointer);
3636
ui.ctx().copy_text(pointer);
37-
ui.close_menu();
3837
}
3938

4039
if ui.button("Copy contents").clicked() {
4140
if let Ok(pretty_str) = serde_json::to_string_pretty(context.value()) {
4241
println!("{}", pretty_str);
4342
ui.ctx().copy_text(pretty_str);
4443
}
45-
ui.close_menu();
4644
}
4745
});
4846
})

examples/demo/src/apps/editor.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
use std::str::FromStr;
22

33
use egui::{
4+
CursorIcon, Margin, TextEdit, Ui,
45
text::{CCursor, CCursorRange},
5-
vec2, CursorIcon, Margin, TextEdit, Ui,
6+
vec2,
67
};
78
use egui_json_tree::{
9+
DefaultExpand, JsonTree, JsonTreeStyle, ToggleButtonsState,
810
delimiters::ExpandableDelimiter,
911
pointer::JsonPointerSegment,
1012
render::{
1113
DefaultRender, RenderBaseValueContext, RenderContext, RenderExpandableDelimiterContext,
1214
RenderPropertyContext,
1315
},
14-
DefaultExpand, JsonTree, JsonTreeStyle, ToggleButtonsState,
1516
};
1617
use serde_json::Value;
1718

@@ -167,7 +168,6 @@ impl Editor {
167168
if let Some(state) = context.collapsing_state.as_mut() {
168169
state.set_open(true);
169170
}
170-
ui.close_menu();
171171
}
172172

173173
if context.value.is_array() && ui.button("Add to array").clicked() {
@@ -177,7 +177,6 @@ impl Editor {
177177
if let Some(state) = context.collapsing_state.as_mut() {
178178
state.set_open(true);
179179
}
180-
ui.close_menu();
181180
}
182181

183182
if let Some(parent) = context.pointer.parent() {
@@ -190,7 +189,6 @@ impl Editor {
190189
request_focus: true,
191190
is_new_key: false,
192191
}));
193-
ui.close_menu()
194192
}
195193
}
196194

@@ -206,7 +204,6 @@ impl Editor {
206204
},
207205
};
208206
self.edit_events.push(event);
209-
ui.close_menu();
210207
}
211208
}
212209
});
@@ -227,7 +224,6 @@ impl Editor {
227224
new_value_input: context.value.to_string(),
228225
request_focus: true,
229226
}));
230-
ui.close_menu();
231227
}
232228

233229
match (context.pointer.parent(), context.pointer.last()) {
@@ -237,7 +233,6 @@ impl Editor {
237233
object_pointer: parent.to_json_pointer_string(),
238234
key: key.to_string(),
239235
});
240-
ui.close_menu();
241236
}
242237
}
243238
(Some(parent), Some(JsonPointerSegment::Index(idx))) => {
@@ -246,7 +241,6 @@ impl Editor {
246241
array_pointer: parent.to_json_pointer_string(),
247242
idx: *idx,
248243
});
249-
ui.close_menu();
250244
}
251245
}
252246
_ => {}
@@ -273,7 +267,6 @@ impl Editor {
273267
pointer: context.pointer.to_json_pointer_string(),
274268
});
275269
context.collapsing_state.set_open(true);
276-
ui.close_menu();
277270
}
278271
});
279272
}
@@ -290,7 +283,6 @@ impl Editor {
290283
pointer: context.pointer.to_json_pointer_string(),
291284
});
292285
context.collapsing_state.set_open(true);
293-
ui.close_menu();
294286
}
295287
});
296288
}

0 commit comments

Comments
 (0)