Is any option to filter get_global_mouse_pos() when mouse is outside the canvas ( A.K.A---> in the black bars)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 807
:warning: Old Version Published before Godot 3 was released.

I don´t know if this is a not documented feature, or i´m unable to find that, or is something that involves calculate rect of viewport + transform offset…
Anyway, why is canvas returning mouse pos when you have mouse outside the canvas (in the black bars)? This is expected? Black bars are not a boundary to the game?

Technically it sounds like it is expected because you are still over the window, but could be reported on Github as an improvement to make to the engine maybe? Since black bars litterally are non-game space^^

Maybe you can clamp the position?

Zylann | 2018-01-08 13:53

Yes… I did this morning a workaround for that, but involves a lot of process every InputEventMouseMotion. Until godot3 goes stable maybe is best no ask for features. This one is “minor one” but it’s strange to not have a signal or special input event when cursor is outside canvas, you can travel in the game like in a “dark secret level”.

807 | 2018-01-08 14:34