Skip to content

Commit f57f0cf

Browse files
committed
Fix tooltip getting stuck if its selection despawns
1 parent a185ac1 commit f57f0cf

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/ui/tooltip.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ impl Configure for Tooltip {
9191
update_tooltip_text,
9292
)
9393
.in_set(UpdateSet::SyncLate)
94-
.after(detect_tooltip_hover)
9594
.run_if(on_event::<TooltipHover>()),
9695
);
9796
app.add_systems(
@@ -184,12 +183,11 @@ struct TooltipHover(Option<Entity>);
184183
impl Configure for TooltipHover {
185184
fn configure(app: &mut App) {
186185
app.add_event::<TooltipHover>();
187-
app.add_systems(Update, detect_tooltip_hover.in_set(UpdateSet::SyncLate));
186+
app.add_systems(Update, detect_tooltip_hover.in_set(UpdateSet::RecordInput));
188187
}
189188
}
190189

191190
fn detect_tooltip_hover(
192-
entities: &Entities,
193191
mut events: EventWriter<TooltipHover>,
194192
tooltip_root: Res<TooltipRoot>,
195193
tooltip_query: Query<&Selection>,
@@ -206,15 +204,13 @@ fn detect_tooltip_hover(
206204
continue;
207205
}
208206

209-
// Show tooltip.
207+
// Hovering something new: Update tooltip.
210208
if selection.0 != entity {
211209
events.send(TooltipHover(Some(entity)));
212210
}
213211
return;
214212
}
215213

216-
// Hide tooltip.
217-
if entities.contains(selection.0) {
218-
events.send(TooltipHover(None));
219-
}
214+
// Not hovering anything: Hide tooltip.
215+
events.send(TooltipHover(None));
220216
}

0 commit comments

Comments
 (0)