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 and Area3D don't trigger the mouse_entered and mouse_exited when dragging from a Control #75120

Closed
IvanIG3 opened this issue Mar 19, 2023 · 12 comments

Comments

@IvanIG3
Copy link

IvanIG3 commented Mar 19, 2023

Godot version

4.0.stable

System information

Windows 10

Issue description

The Area2D and the Area3D do not trigger the signals mouse_entered and mouse_exited if the mouse is dragging from inside a Control. But, a Control triggers the signals mouse_entered and mouse_exited when dragging from another Control.
I don't know if this is intended, or it is a bug, but I think that the two nodes should behave the same.

mouse_hover.mp4

Steps to reproduce

Execute the project below. When hovering the "Area" and the "Control", the color_rect turns red. But if dragging from the "Drag", only the "Control" turns red.

Minimal reproduction project

MouseInputTest.zip

@Sauermann
Copy link
Contributor

Drag&Drop operations currently works by maintaining focus on the Control, that initially started the D&D-operation.
This focus prevents Area2D from receiving these InputEvents, so it works as expected.
I would have to dig deeper into the code to tell, if it is feasible to make this work.
But since Godot doesn't support Drag&Drop from a Control onto an Area2D, I don't know, if it makes sense.

@IvanIG3
Copy link
Author

IvanIG3 commented Mar 20, 2023

Do you know if there is a way to workaround this behavior? Maybe by telling the Control to lose this focus on click someway? Thanks!

@KoBeWi
Copy link
Member

KoBeWi commented Mar 20, 2023

As a workaround you can manually poll the mouse position and check if it overlaps.

@IvanIG3
Copy link
Author

IvanIG3 commented Jul 18, 2023

This issue has changed with version 4,1 and 4.1.1.

Now Area2D and Area3D trigger the mouse_entered and mouse_exited signals if the mouse is dragging from inside a Control. But, if a Control is over an Area, no matter if the Control has the mouse_filter on Stop, the Area will capture the mouse. Is this ok?

mouse_hover_2.mp4

@KoBeWi
Copy link
Member

KoBeWi commented Jul 18, 2023

Well, the documentation of MOUSE_FILTER_STOP mentions only that it prevents passing event to other controls, it doesn't mention physic objects. Although I think it makes sense to block it 🤔 Also tree order doesn't seem to matter at all.

@Sauermann
Copy link
Contributor

But, if a Control is over an Area, no matter if the Control has the mouse_filter on Stop, the Area will capture the mouse. Is this ok?

That is not ok and a regression from #78017.
I have updated #79443 to fix this problem: while the mouse cursor is over the Control, the Area2D should not receive any events.

@Sauermann
Copy link
Contributor

The mentioned fix got included in Godot 4.2 dev-2.
@IvanIG3 it would help, if you could provide feedback, if the problem is resolved for you in 4.2 dev-2.

@IvanIG3
Copy link
Author

IvanIG3 commented Jul 31, 2023

I've tested the 4.2 dev-2. Now the Control blocks the Area when it's over it. But, if I release the mouse button when I'm hovering the Control, the Area ignores the Control and captures the mouse.

mouse_hover_3.mp4

@Sauermann
Copy link
Contributor

@IvanIG3 thanks for testing, but unfortunately I can't replicate the behavior, that you are describing in v4.2.dev2.official [da81ca6] on Linux X11 Xfce and on Windows 10.

My procedure for testing:

  1. download and start the MRP of the opening post
  2. in the Editor, reposition the right Control, so that it overlaps with the middle Area2D
  3. run project
  4. drag from left Control
  5. release in the intersection area of middle Area2D and right Control

After step 5, for me the Area2D is not filled with red color.

Is it possible, that we use different project files?

@IvanIG3
Copy link
Author

IvanIG3 commented Jul 31, 2023

@Sauermann Ah yes, you are right. I had something messed up with the project. I downloaded the MRP and tested it again and it works fine now. Sorry for the confusion.

@Sauermann
Copy link
Contributor

@IvanIG3 thanks for the clarification. Just to double check I would like to get confirmation from you, if you consider the original problem to be solved now, so that this issue can be closed now.

@IvanIG3
Copy link
Author

IvanIG3 commented Jul 31, 2023

Yes, the original problem is solved now and the issue can be closed.

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

No branches or pull requests

3 participants