Skip to content

Commit

Permalink
Bug Fix : Response::is_pointer_button_down_on is now false the fram…
Browse files Browse the repository at this point in the history
…e the button is released (#3833)

* Closes #3809
* Closes #3669
* Closes #3791

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
  • Loading branch information
rustbasic and emilk committed Jan 17, 2024
1 parent f01d337 commit 7733d1d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
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

0 comments on commit 7733d1d

Please sign in to comment.