Avoid some `Id` clashes by seeding auto-ids with child id (#4840)
I was having trouble with id collisions and was not able to resolve it using `push_id` and `child_ui_with_id_source`. When investigating the issue I found https://github.com/emilk/egui/pull/2262 which matched the issues I had so I forked egui and implemented the changes from that PR for the latest version. It solved the issue for me. I did not notice any regressions in my project or the egui web viewer. Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
parent
82814c4fff
commit
0f8614d69e
|
|
@ -225,10 +225,11 @@ impl Ui {
|
|||
}
|
||||
|
||||
debug_assert!(!max_rect.any_nan());
|
||||
let next_auto_id_source = Id::new(self.next_auto_id_source).with("child").value();
|
||||
let new_id = self.id.with(id_source);
|
||||
let next_auto_id_source = new_id.with(self.next_auto_id_source).value();
|
||||
|
||||
self.next_auto_id_source = self.next_auto_id_source.wrapping_add(1);
|
||||
|
||||
let new_id = self.id.with(id_source);
|
||||
let placer = Placer::new(max_rect, layout);
|
||||
let ui_stack = UiStack {
|
||||
id: new_id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue