+1 vote

I need to get events received by a Control, but _input is too low level for my needs, because I have to detect if the mouse is in bounds everytime and perform conversions between screen space and canvas space...

There is a signal input_event on the Control node, but I don't understand when it is sent. After testing, I still wonder why it is triggered or not.

For example, I listen to the MOUSE_MOTION event, but I receive it only for a sub-region of the Control.

If I listen to MOUSE_BUTTON and use the mouse wheel, I receive it for the whole region.

Any idea what is going on?

in Engine by (29,088 points)

1 Answer

0 votes
Best answer

After some guessing around why my touch events didn't show in the inputevent() I think that I found it out.

_input_event is sent to Controls when the event is relevant for them (i.e. mouse position is over it). The event contains control-relative coords. So it is kind of locally to the control.
BUT: It doesn't seem to receive SCREENTOUCH + SCREENDRAG events.

_input events can also be received by controls but their kind is global. So they have viewport coordinates and if a control decides to receive _input() it also receives events prob. indended for other controls. It has to decide itself what is relevant and what not.

More (and maybe more correct) info is here:
http://docs.godotengine.org/en/stable/learning/features/inputs/inputevent.html

by (3,358 points)
selected by

A lot of time passed, now I learned more about events^^
Thank you for your answer :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.