浏览代码

Fix description of GUI input propagation (#7899)

* Fix: Propagation of _gui_input()

_gui_input() calls only propagate up the scene tree for mouse events
with appropriate filter flags. Keyboard and controller events do not
propagate through _gui_input().

Places entire description of _gui_input() propagation in one location,
marks it as a note to separate it from surrounding input propagation,
and updates the description to include behavior of keyboard and
controller events.
Mark Wilson 6 月之前
父节点
当前提交
1fe10df90d
共有 1 个文件被更改,包括 9 次插入5 次删除
  1. 9 5
      tutorials/inputs/inputevent.rst

+ 9 - 5
tutorials/inputs/inputevent.rst

@@ -123,8 +123,15 @@ and SubViewports.
 
 .. image:: img/input_event_scene_flow.webp
 
-This order doesn't apply to :ref:`Control._gui_input() <class_Control_private_method__gui_input>`, which uses
-a different method based on event location or focused Control.
+.. note::
+
+   This order doesn't apply to :ref:`Control._gui_input() <class_Control_private_method__gui_input>`, which uses
+   a different method based on event location or focused Control. GUI **mouse** events also travel 
+   up the scene tree, subject to the :ref:`Control.mouse_filter <class_Control_property_mouse_filter>`
+   restrictions described above. However, since these events target specific Controls, only direct ancestors of 
+   the targeted Control node receive the event. GUI **keyboard and joypad** events *do not* travel
+   up the scene tree, and can only be handled by the Control that received them. Otherwise, they will be
+   propagated as non-GUI events through :ref:`Node._unhandled_input() <class_Node_private_method__unhandled_input>`.
 
 Since Viewports don't send events to other :ref:`SubViewports <class_SubViewport>`, one of the following
 methods has to be used:
@@ -134,9 +141,6 @@ methods has to be used:
    :ref:`Node._input() <class_Node_private_method__input>` or :ref:`Control._gui_input() <class_Control_private_method__gui_input>`.
 2. Implement event propagation based on the individual requirements.
 
-GUI events also travel up the scene tree but, since these events target
-specific Controls, only direct ancestors of the targeted Control node receive the event.
-
 In accordance with Godot's node-based design, this enables
 specialized child nodes to handle and consume particular events, while
 their ancestors, and ultimately the scene root, can provide more