1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 14:49:06 -04:00

Only mark interactive widgets as hovered, if clicking would interact

This commit is contained in:
Emil Ernerfeldt
2024-12-13 08:15:57 +01:00
parent 9aae14cdf4
commit d5cd175b16

View File

@@ -249,7 +249,7 @@ pub(crate) fn interact(
.copied()
.collect()
} else {
// We may be hovering a an interactive widget or two.
// We may be hovering an interactive widget or two.
// We must also consider the case where non-interactive widgets
// are _on top_ of an interactive widget.
// For instance: a label in a draggable window.
@@ -275,6 +275,11 @@ pub(crate) fn interact(
let mut hovered: IdSet = hits.click.iter().chain(&hits.drag).map(|w| w.id).collect();
for w in &hits.contains_pointer {
if w.sense.click || w.sense.drag {
// Interactive widgets are only marked as hover if they are the ones
// selected by the hit-test, and those have already been included.
continue; // TODO: what implications does this have for tooltips? :/
}
if top_interactive_order <= order(w.id).unwrap_or(0) {
hovered.insert(w.id);
}