Skip to content

Commit

Permalink
Fix merge race
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Sep 19, 2024
1 parent 902c54e commit b178424
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/egui/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,9 +1023,9 @@ impl Ui {
/// It's [`Sense`] will be based on the [`UiBuilder::sense`] used to create this [`Ui`].
///
/// The rectangle of the [`Response`] (and interactive area) will be [`Self::min_rect`]
/// of the last frame.
/// of the last pass.
///
/// On the first frame, when the [`Ui`] is created, this will return a [`Response`] with a
/// The very first time when the [`Ui`] is created, this will return a [`Response`] with a
/// [`Rect`] of [`Rect::NOTHING`].
pub fn response(&self) -> Response {
// This is the inverse of Context::read_response. We prefer a response
Expand All @@ -1034,10 +1034,10 @@ impl Ui {
self.ctx()
.viewport(|viewport| {
viewport
.prev_frame
.prev_pass
.widgets
.get(self.id)
.or_else(|| viewport.this_frame.widgets.get(self.id))
.or_else(|| viewport.this_pass.widgets.get(self.id))
.copied()
})
.map(|widget_rect| self.ctx().get_response(widget_rect))
Expand All @@ -1053,7 +1053,7 @@ impl Ui {
// We remove the id from used_ids to prevent a duplicate id warning from showing
// when the ui was created with `UiBuilder::sense`.
// This is a bit hacky, is there a better way?
self.ctx().frame_state_mut(|fs| {
self.ctx().pass_state_mut(|fs| {
fs.used_ids.remove(&self.id);
});
// This will update the WidgetRect that was first created in `Ui::new`.
Expand Down

0 comments on commit b178424

Please sign in to comment.