Fix secondary-click to open a menu
Fixes https://github.com/emilk/egui/issues/198
This commit is contained in:
parent
fa4752f315
commit
007f9f3cb9
4 changed files with 7 additions and 8 deletions
|
@ -9,6 +9,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
|
||||
## Unreleased
|
||||
|
||||
### Fixed 🐛
|
||||
|
||||
* Fixed secondary-click to open a menu
|
||||
|
||||
|
||||
## 0.10.0 - 2021-02-28 - Plot and polish
|
||||
|
||||
|
|
|
@ -185,9 +185,7 @@ pub fn popup_below_widget(
|
|||
});
|
||||
});
|
||||
|
||||
if ui.input().key_pressed(Key::Escape)
|
||||
|| ui.input().pointer.any_click() && !widget_response.clicked()
|
||||
{
|
||||
if ui.input().key_pressed(Key::Escape) || widget_response.clicked_elsewhere() {
|
||||
ui.memory().close_popup();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,9 +117,7 @@ fn menu_impl<'c>(
|
|||
});
|
||||
|
||||
// TODO: this prevents sub-menus in menus. We should fix that.
|
||||
if ui.input().key_pressed(Key::Escape)
|
||||
|| ui.input().pointer.any_click() && !button_response.clicked()
|
||||
{
|
||||
if ui.input().key_pressed(Key::Escape) || button_response.clicked_elsewhere() {
|
||||
bar_state.open_menu = None;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -342,8 +342,7 @@ pub fn color_edit_button_hsva(ui: &mut Ui, hsva: &mut Hsva, alpha: Alpha) -> Res
|
|||
});
|
||||
|
||||
if !button_response.clicked() {
|
||||
let clicked_outside = ui.input().pointer.any_click() && !area_response.hovered();
|
||||
if clicked_outside || ui.input().key_pressed(Key::Escape) {
|
||||
if ui.input().key_pressed(Key::Escape) || area_response.clicked_elsewhere() {
|
||||
ui.memory().close_popup();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue