mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 14:20:04 -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:
@@ -1301,7 +1301,7 @@ fn translate_cursor(cursor_icon: egui::CursorIcon) -> Option<winit::window::Curs
|
||||
// ---------------------------------------------------------------------------
|
||||
#[derive(PartialEq, Eq, Hash, Debug)]
|
||||
pub enum ActionRequested {
|
||||
Screenshot,
|
||||
Screenshot(egui::UserData),
|
||||
Cut,
|
||||
Copy,
|
||||
Paste,
|
||||
@@ -1516,8 +1516,8 @@ fn process_viewport_command(
|
||||
log::warn!("{command:?}: {err}");
|
||||
}
|
||||
}
|
||||
ViewportCommand::Screenshot => {
|
||||
actions_requested.insert(ActionRequested::Screenshot);
|
||||
ViewportCommand::Screenshot(user_data) => {
|
||||
actions_requested.insert(ActionRequested::Screenshot(user_data));
|
||||
}
|
||||
ViewportCommand::RequestCut => {
|
||||
actions_requested.insert(ActionRequested::Cut);
|
||||
|
||||
Reference in New Issue
Block a user