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

Fix: Popups do not appear in certain situations. #5107

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
10 changes: 1 addition & 9 deletions crates/egui/src/input_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,7 @@ impl PointerState {
press_origin.distance(pos) > self.input_options.max_click_dist;
}

self.last_move_time = time;
self.pointer_events.push(PointerEvent::Moved(pos));
}
Event::PointerButton {
Expand Down Expand Up @@ -1028,15 +1029,6 @@ impl PointerState {

self.pos_history.flush(time);

self.velocity = if self.pos_history.len() >= 3 && self.pos_history.duration() > 0.01 {
self.pos_history.velocity().unwrap_or_default()
} else {
Vec2::default()
};
if self.velocity != Vec2::ZERO {
self.last_move_time = time;
}

self.direction = self.pos_history.velocity().unwrap_or_default().normalized();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The root cause is that last_move_time is not updated in certain situations (slow situations).


self.started_decidedly_dragging = self.is_decidedly_dragging() && !was_decidedly_dragging;
Expand Down
3 changes: 2 additions & 1 deletion crates/egui/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ impl Response {

let clicked_more_recently_than_moved =
time_since_last_click < time_since_last_pointer_movement + 0.1;
if clicked_more_recently_than_moved {
if clicked_more_recently_than_moved && (self.clicked() || self.is_pointer_button_down_on())
{
// It is common to click a widget and then rest the mouse there.
// It would be annoying to then see a tooltip for it immediately.
// Similarly, clicking should hide the existing tooltip.
Expand Down
Loading