summaryrefslogtreecommitdiff
path: root/editor/plugins/shader_graph_editor_plugin.cpp
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2018-03-27 23:41:27 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2018-04-07 01:06:02 +0200
commit259ed1d40019543dd22c3741eedfd19ff0a7a500 (patch)
tree0086bf615e23c09c667d46c3db7965d3db63d4bb /editor/plugins/shader_graph_editor_plugin.cpp
parent4a5723f59e0437dc9f83f7116b8fddd12e15c5d0 (diff)
Improve popup menus usability
It seems that popups were intended to "grab" the mouse click that triggered them, but their intent was being lost. This commit does the necessary changes to let it happen and updates items that were trying to get advantage of it, because the semantics of `Control::grab_click_focus()` have changed a bit. Namely, it must be called **before** showing the modal. This allows to popup a menu and activate an item in it in a single click-point-release cycle, instead of having to click once to open the menu and once more to pick an item. This ability is extended even to context menus activated with the RMB (or any other mouse button, for that matter). The editor benefits from this in the context menu of the tree dock, which has been patched to opt-in for this feature. This improves UX a bit by saving unnecessary clicks. From now on, `PopupMenu` always grabs the click and also invalidates the first button release unless the mouse has moved (that's what `set_invalidate_click_until_motion()` was doing and now it's removed), so there is no longer the need of doing both things at every point a pop-up menu is shown.
Diffstat (limited to 'editor/plugins/shader_graph_editor_plugin.cpp')
-rw-r--r--editor/plugins/shader_graph_editor_plugin.cpp2
1 files changed, 0 insertions, 2 deletions
diff --git a/editor/plugins/shader_graph_editor_plugin.cpp b/editor/plugins/shader_graph_editor_plugin.cpp
index 59085c203f..e1d28cc215 100644
--- a/editor/plugins/shader_graph_editor_plugin.cpp
+++ b/editor/plugins/shader_graph_editor_plugin.cpp
@@ -2769,8 +2769,6 @@ void ShaderGraphEditor::_popup_requested(const Vector2 &p_position)
popup->set_global_position(p_position);
popup->set_size( Size2( 200, 0) );
popup->popup();
- popup->call_deferred("grab_click_focus");
- popup->set_invalidate_click_until_motion();
}
void ShaderGraphEditor::_notification(int p_what) {