mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 23:00:04 -04:00
More cleaning
This commit is contained in:
@@ -417,7 +417,7 @@ impl EguiWindows {
|
||||
egui::Window::new("🔧 Settings")
|
||||
.open(settings)
|
||||
.vscroll(true)
|
||||
.show(ctx, move |ui| {
|
||||
.show(ctx, |ui| {
|
||||
tmp_ctx.settings_ui(ui);
|
||||
});
|
||||
|
||||
@@ -425,7 +425,7 @@ impl EguiWindows {
|
||||
egui::Window::new("🔍 Inspection")
|
||||
.open(inspection)
|
||||
.vscroll(true)
|
||||
.show(ctx, move |ui| {
|
||||
.show(ctx, |ui| {
|
||||
tmp_ctx.inspection_ui(ui);
|
||||
});
|
||||
|
||||
@@ -433,7 +433,7 @@ impl EguiWindows {
|
||||
egui::Window::new("📝 Memory")
|
||||
.open(memory)
|
||||
.resizable(false)
|
||||
.show(ctx, move |ui| {
|
||||
.show(ctx, |ui| {
|
||||
tmp_ctx.memory_ui(ui);
|
||||
});
|
||||
|
||||
@@ -442,7 +442,7 @@ impl EguiWindows {
|
||||
.open(output_events)
|
||||
.resizable(true)
|
||||
.default_width(520.0)
|
||||
.show(ctx, move |ui| {
|
||||
.show(ctx, |ui| {
|
||||
ui.label(
|
||||
"Recent output events from egui. \
|
||||
These are emitted when you interact with widgets, or move focus between them with TAB. \
|
||||
|
||||
@@ -6,7 +6,6 @@ use eframe::glow;
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use core::any::Any;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
#[derive(Default)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
@@ -185,7 +184,7 @@ pub struct WrapApp {
|
||||
#[cfg(any(feature = "glow", feature = "wgpu"))]
|
||||
custom3d: Option<crate::apps::Custom3d>,
|
||||
|
||||
dropped_files: Arc<RwLock<Vec<egui::DroppedFile>>>,
|
||||
dropped_files: Vec<egui::DroppedFile>,
|
||||
}
|
||||
|
||||
impl WrapApp {
|
||||
@@ -464,20 +463,19 @@ impl WrapApp {
|
||||
// Collect dropped files:
|
||||
ctx.input(|i| {
|
||||
if !i.raw.dropped_files.is_empty() {
|
||||
*self.dropped_files.write().unwrap() = i.raw.dropped_files.clone();
|
||||
self.dropped_files = i.raw.dropped_files.clone();
|
||||
}
|
||||
});
|
||||
|
||||
// Show dropped files (if any):
|
||||
let is_empty = self.dropped_files.read().unwrap().is_empty();
|
||||
let is_empty = self.dropped_files.is_empty();
|
||||
if !is_empty {
|
||||
let mut open = true;
|
||||
let dropped_files = self.dropped_files.clone();
|
||||
egui::Window::new("Dropped files")
|
||||
.open(&mut open)
|
||||
.show(ctx, move |ui| {
|
||||
let dropped_files = &*dropped_files.read().unwrap();
|
||||
for file in dropped_files {
|
||||
.show(ctx, |ui| {
|
||||
for file in &dropped_files {
|
||||
let mut info = if let Some(path) = &file.path {
|
||||
path.display().to_string()
|
||||
} else if !file.name.is_empty() {
|
||||
@@ -492,7 +490,7 @@ impl WrapApp {
|
||||
}
|
||||
});
|
||||
if !open {
|
||||
self.dropped_files.write().unwrap().clear();
|
||||
self.dropped_files.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user