1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 22:00:03 -04:00

WIP: Add code formatting of id debug strings

This commit is contained in:
lucasmerlin
2026-03-20 11:48:42 +01:00
parent 08bf4c2d53
commit c4fb03ed7c
2 changed files with 202 additions and 1 deletions

View File

@@ -1,3 +1,5 @@
use egui::Id;
#[derive(Default)]
pub struct IdTest {}
@@ -50,8 +52,15 @@ impl crate::View for IdTest {
let button_response = ui.button("Button");
let _ = ui.button("Button");
let parent = Id::new("parent");
let child = parent.with("child");
let grandchild = child.with("grandchild");
let nested = Id::new(grandchild).with(grandchild);
ui.label("Use id.ui() to show a interactive debug ui that explains how a id was derived:");
button_response.id.ui(ui);
nested.ui(ui);
ui.label("Debug formatting the id will also show the hierarchy (useful when logging ids):");
ui.code(format!("{:?}", button_response.id));