mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 06:40:06 -04:00
Add ui.data(), ctx.data(), ctx.options() and ctx.tessellation_options() (#1175)
Helpful access deeper into Memory
This commit is contained in:
@@ -19,7 +19,7 @@ pub fn password_ui(ui: &mut egui::Ui, password: &mut String) -> egui::Response {
|
||||
|
||||
// Get state for this widget.
|
||||
// You should get state by value, not by reference to avoid borrowing of `Memory`.
|
||||
let mut show_plaintext = ui.memory().data.get_temp::<bool>(state_id).unwrap_or(false);
|
||||
let mut show_plaintext = ui.data().get_temp::<bool>(state_id).unwrap_or(false);
|
||||
|
||||
// Process ui, change a local copy of the state
|
||||
// We want TextEdit to fill entire space, and have button after that, so in that case we can
|
||||
@@ -42,7 +42,7 @@ pub fn password_ui(ui: &mut egui::Ui, password: &mut String) -> egui::Response {
|
||||
});
|
||||
|
||||
// Store the (possibly changed) state:
|
||||
ui.memory().data.insert_temp(state_id, show_plaintext);
|
||||
ui.data().insert_temp(state_id, show_plaintext);
|
||||
|
||||
// All done! Return the interaction response so the user can check what happened
|
||||
// (hovered, clicked, …) and maybe show a tooltip:
|
||||
|
||||
Reference in New Issue
Block a user