How to tell when a panel is hovered? #4996
-
I have a SidePanel, and I want to know when the cursor is hovering over it, or clicked on it, so that I can stop the mouse input from being used else where. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I'm not sure why impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::SidePanel::left("left").show(ctx, |ui| {
ui.painter()
.rect_filled(ui.min_rect(), 0.0, Color32::RED.gamma_multiply(0.3));
ui.painter()
.rect_filled(ui.max_rect(), 0.0, Color32::BLUE.gamma_multiply(0.3));
let min_contains = ui.ui_contains_pointer();
let max_contains = ui.rect_contains_pointer(ui.max_rect());
ui.label(format!("{:?}", min_contains));
ui.button(format!("{:?}", max_contains));
});
egui::CentralPanel::default().show(ctx, |ui| {
ui.label("Central");
});
}
} Screencast.from.2024-08-24.10-27-23.mp4 |
Beta Was this translation helpful? Give feedback.
Aha by ||ing your strategy with memory.any_popup_open() it now works hopefully perfectly!