Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid some Id clashes by seeding auto-ids with child id #4840

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions crates/egui/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading