mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Allow attaching custom user data to a screenshot command (#5416)
This lets users trigger a screenshot from anywhere, and then when they get back the results they have some context about what part of their code triggered the screenshot.
This commit is contained in:
@@ -45,7 +45,7 @@ impl eframe::App for MyApp {
|
||||
|
||||
if ui.button("save to 'top_left.png'").clicked() {
|
||||
self.save_to_file = true;
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Screenshot);
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Screenshot(Default::default()));
|
||||
}
|
||||
|
||||
ui.with_layout(egui::Layout::top_down(egui::Align::RIGHT), |ui| {
|
||||
@@ -58,9 +58,13 @@ impl eframe::App for MyApp {
|
||||
} else {
|
||||
ctx.set_theme(egui::Theme::Light);
|
||||
};
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Screenshot);
|
||||
ctx.send_viewport_cmd(
|
||||
egui::ViewportCommand::Screenshot(Default::default()),
|
||||
);
|
||||
} else if ui.button("take screenshot!").clicked() {
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Screenshot);
|
||||
ctx.send_viewport_cmd(
|
||||
egui::ViewportCommand::Screenshot(Default::default()),
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user