mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 12:12:28 +00:00
Merge pull request #85966 from Kimau/claire/expose_mouseover
Expose a method to get hovered Control in Viewport
This commit is contained in:
commit
a4d789370f
@ -128,6 +128,13 @@
|
|||||||
Returns the [Control] having the focus within this viewport. If no [Control] has the focus, returns null.
|
Returns the [Control] having the focus within this viewport. If no [Control] has the focus, returns null.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
|
<method name="gui_get_hovered_control" qualifiers="const">
|
||||||
|
<return type="Control" />
|
||||||
|
<description>
|
||||||
|
Returns the [Control] that the mouse is currently hovering over in this viewport. If no [Control] has the cursor, returns null.
|
||||||
|
Typically the leaf [Control] node or deepest level of the subtree which claims hover. This is very useful when used together with [method Node.is_ancestor_of] to find if the mouse is within a control tree.
|
||||||
|
</description>
|
||||||
|
</method>
|
||||||
<method name="gui_is_drag_successful" qualifiers="const">
|
<method name="gui_is_drag_successful" qualifiers="const">
|
||||||
<return type="bool" />
|
<return type="bool" />
|
||||||
<description>
|
<description>
|
||||||
|
@ -3518,6 +3518,11 @@ Control *Viewport::gui_get_focus_owner() const {
|
|||||||
return gui.key_focus;
|
return gui.key_focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Control *Viewport::gui_get_hovered_control() const {
|
||||||
|
ERR_READ_THREAD_GUARD_V(nullptr);
|
||||||
|
return gui.mouse_over;
|
||||||
|
}
|
||||||
|
|
||||||
void Viewport::set_msaa_2d(MSAA p_msaa) {
|
void Viewport::set_msaa_2d(MSAA p_msaa) {
|
||||||
ERR_MAIN_THREAD_GUARD;
|
ERR_MAIN_THREAD_GUARD;
|
||||||
ERR_FAIL_INDEX(p_msaa, MSAA_MAX);
|
ERR_FAIL_INDEX(p_msaa, MSAA_MAX);
|
||||||
@ -4557,6 +4562,7 @@ void Viewport::_bind_methods() {
|
|||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("gui_release_focus"), &Viewport::gui_release_focus);
|
ClassDB::bind_method(D_METHOD("gui_release_focus"), &Viewport::gui_release_focus);
|
||||||
ClassDB::bind_method(D_METHOD("gui_get_focus_owner"), &Viewport::gui_get_focus_owner);
|
ClassDB::bind_method(D_METHOD("gui_get_focus_owner"), &Viewport::gui_get_focus_owner);
|
||||||
|
ClassDB::bind_method(D_METHOD("gui_get_hovered_control"), &Viewport::gui_get_hovered_control);
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("set_disable_input", "disable"), &Viewport::set_disable_input);
|
ClassDB::bind_method(D_METHOD("set_disable_input", "disable"), &Viewport::set_disable_input);
|
||||||
ClassDB::bind_method(D_METHOD("is_input_disabled"), &Viewport::is_input_disabled);
|
ClassDB::bind_method(D_METHOD("is_input_disabled"), &Viewport::is_input_disabled);
|
||||||
|
@ -610,6 +610,7 @@ public:
|
|||||||
|
|
||||||
void gui_release_focus();
|
void gui_release_focus();
|
||||||
Control *gui_get_focus_owner() const;
|
Control *gui_get_focus_owner() const;
|
||||||
|
Control *gui_get_hovered_control() const;
|
||||||
|
|
||||||
PackedStringArray get_configuration_warnings() const override;
|
PackedStringArray get_configuration_warnings() const override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user