Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Area2D receives mouse input events from outside root viewport #80011

Closed
romlok opened this issue Jul 29, 2023 · 1 comment · Fixed by #80334
Closed

Area2D receives mouse input events from outside root viewport #80011

romlok opened this issue Jul 29, 2023 · 1 comment · Fixed by #80334

Comments

@romlok
Copy link
Contributor

romlok commented Jul 29, 2023

Godot version

v4.1.1.stable.official [bd6af8e]

System information

Godot v4.1.1.stable - Debian GNU/Linux trixie/sid trixie - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 (nvidia) - Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz (6 Threads)

Issue description

Area2Ds which extend beyond the bounds of the root viewport, eg. when using a canvas_items stretch mode, receive mouse input events even in the black bands letterboxing the game:

simplescreenrecorder-2023-07-29_13.40.59.mp4

Steps to reproduce

  1. Set project stretch mode to either canvas_items or viewport
  2. Have an Area2D whose CollisionShape extends beyond the bounds of the rendered region
  3. Connect the Area2D's mouse_[entered|exited] signal to something
  4. Wave the mouse around in the black areas outside the rendered game

Minimal reproduction project

Project used for video demo above:

area2d-oob.zip

This only demos mouse_[entered|exited], but I first encountered this with the Area2D.input_event signal, where it received mouse clicks as well.

@Sauermann Sauermann added this to the 4.x milestone Jul 29, 2023
@Sauermann
Copy link
Contributor

Sauermann commented Jul 29, 2023

I can confirm this issue also for the following situations:

  • for Control-nodes that are located outside of the stretched root-Viewport
  • a SubViewport of size (100,100) is within a SubViewportContainer of size (200,200) and contains a Control/Area2D, that lies right/below of the (100, 100) size.

I had a quick look and these aspects are directly affected by #67791, so I believe, that it would make sense to wait for that PR before diving into this issue.

In the meantime as a workaround for the Area2D.input_event-issue, you could check, if the mouse cursor is within the area of the Viewport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants