diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index f2f9614200c..07a6ec38f49 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -1081,6 +1081,7 @@ impl Context { clicked && click.is_triple(); } } + response.is_pointer_button_down_on = false; } } } diff --git a/crates/egui/src/style.rs b/crates/egui/src/style.rs index ebadb286d17..6422e654723 100644 --- a/crates/egui/src/style.rs +++ b/crates/egui/src/style.rs @@ -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 diff --git a/examples/custom_window_frame/src/main.rs b/examples/custom_window_frame/src/main.rs index 6008788bd0f..87daf82e06a 100644 --- a/examples/custom_window_frame/src/main.rs +++ b/examples/custom_window_frame/src/main.rs @@ -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); }