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

Bug Fix : Response::is_pointer_button_down_on is now false the frame the button is released #3833

Merged
merged 8 commits into from
Jan 17, 2024
Merged
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
1 change: 1 addition & 0 deletions crates/egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,7 @@ impl Context {
clicked && click.is_triple();
}
}
response.is_pointer_button_down_on = false;
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion crates/egui/src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,8 @@ impl Widgets {
pub fn style(&self, response: &Response) -> &WidgetVisuals {
if !response.sense.interactive() {
&self.noninteractive
} else if response.is_pointer_button_down_on() || response.has_focus() {
} else if response.is_pointer_button_down_on() || response.has_focus() || response.clicked()
{
&self.active
} else if response.hovered() || response.highlighted() {
&self.hovered
Expand Down
4 changes: 3 additions & 1 deletion examples/custom_window_frame/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ fn title_bar_ui(ui: &mut egui::Ui, title_bar_rect: eframe::epaint::Rect, title:
let is_maximized = ui.input(|i| i.viewport().maximized.unwrap_or(false));
ui.ctx()
.send_viewport_cmd(ViewportCommand::Maximized(!is_maximized));
} else if title_bar_response.is_pointer_button_down_on() {
}

if title_bar_response.is_pointer_button_down_on() {
ui.ctx().send_viewport_cmd(ViewportCommand::StartDrag);
}

Expand Down
Loading