godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.86k stars 21k forks source link

TopLevel + MouseFilter::PASS doesn't propagate gui_input events to parent #88832

Open MatrixDev opened 7 months ago

MatrixDev commented 7 months ago

Tested versions

GoDot v4.2.1.stable.official [b09f793f5]

System information

MacOS 14.1.1 - Vulkan API 1.2.231 - Forward+ - Apple M1 Max

Issue description

Mouse events in gui_input don't propagate to parent when child has Top Level set to true.

Steps to reproduce

  1. create parent
  2. add child to parent
  3. set child to top level and mouse filter to pass
  4. observe gui_input events in parent area

Minimal reproduction project (MRP)

bug.zip

Sauermann commented 7 months ago

This works as designed. The intention of Top Level implies, that the Control-node has basically no other Cotrol as parent. The documentation of top_level already states: "The CanvasItem will effectively act as if it was placed as a child of a bare Node." The documentation of MOUSE_FILTER_PASS could be improved by mentioning this behavior of top_level.

MatrixDev commented 7 months ago

@Sauermann, I think documentation for top_level should be adjusted as well. Currently it mostly talks about drawing, so I thought parent example was also just for drawing (like z_index). probably better to add that it also affects inputs events.