Godot: clipping only limits the appearance, input events can still hit the invisible nodes

Created on 12 Jun 2016  Â·  11Comments  Â·  Source: godotengine/godot

Operating system or device - Godot version:
every operating system

Issue description (what happened, and what was expected):
if you set canvas_item_set_clip to true you can not see the nodes without the bounding limit but the input still hit it .

Steps to reproduce:

Link to minimal example project (optional but very welcome):

bug confirmed gui

Most helpful comment

I just found a way to fix it. Instead of setting a clips_input variable that does not exist, you need to implement a function like this:

func _clips_input():
    return true

It works as expected, but this way is un-documented, obscure (I had to dig a lot in the C++ source), and a bit strange, compared to:

  1. Just having a variable clips_input or
  2. Make bool Control::clips_input() const return rect_clip_contents by default.

All 11 comments

isn't cliping a graphics thing? why would input be affected by it?

when something is not in the scene why it should get inputs??

scene is one thing, screen is another. what do you mean?

On 19-06-2016 11:58, Mohammad Hadi Aliakbar wrote:

when something is not in the scene why it should get inputs??

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/5172#issuecomment-226991151,
or mute the thread
https://github.com/notifications/unsubscribe/ABkOH4yjqRf1PvQLcoZAJgXybe8Yz5y4ks5qNSDmgaJpZM4IzyrU.

Nuno Donato
[email protected] | 966956602

www.estudiodigital.pt http://www.estudiodigital.pt/
Programação e Artes Digitais

my bad I mean screen when somethins is not shown it should not get input

I dont think that makes sense

On 20-06-2016 11:16, Mohammad Hadi Aliakbar wrote:

my bad I mean screen when somethins is not shown it should not get input

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/5172#issuecomment-227103568,
or mute the thread
https://github.com/notifications/unsubscribe/ABkOH6ySokt5HgEYc7OqBUbYoUtafMkgks5qNmhugaJpZM4IzyrU.

Nuno Donato
[email protected] | 966956602

www.estudiodigital.pt http://www.estudiodigital.pt/
Programação e Artes Digitais

make a scroll container then add a vbox or hbox then fill it with lots of buttons each button when clicked print it's name in label , now export it to android and touch and scroll if you touch inside a button and scroll till it's outside the view and you touch up it will be hit and it's name will be printed.

it does not make sense that some node that it's not there and clipped get an input .

First of all thank you for your report and sorry for the delay.

We released Godot 3.0 in January 2018 after 18 months of work, fixing many old issues either directly, or by obsoleting/replacing the features they were referring to.

We still have hundreds of issues whose relevance/reproducibility needs to be checked against the current stable version, and that's where you can help us.
Could you check if the issue that you described initially is still relevant/reproducible in Godot 3.0 or any newer version, and comment about it here?

For bug reports, please also make sure that the issue contains detailed steps to reproduce the bug and, if possible, a zipped project that can be used to reproduce it right away. This greatly speeds up debugging and bugfixing tasks for our contributors.

Our Bugsquad will review this issue more in-depth in 15 days, and potentially close it if its relevance could not be confirmed.

Thanks in advance.

Note: This message is being copy-pasted to many "stale" issues (90+ days without activity). It might happen that it is not meaningful for this specific issue or appears oblivious of the issue's context, if so please comment to notify the Bugsquad about it.

I can confirm this still happens - Clip Content will graphically clip the childs, but will still let input through as if they're all fully visible; whether that is intended or not is disputable, but I agree it wouldn't make any sense for invisible childs to receive input and act as if visible. If you set a button's visibility to "false" it cannot be pressed, so I would expect the same behavior to hold true for all invisible controls.

This answer here contains an example of a possible fix, maybe that could be implemented?
https://godotengine.org/qa/1628/how-to-clip-input-events-to-the-size-of-a-parent-control-node

I just ran into this issue as well on stable 3.1.1 (mono). So it's definitely still present.

I think that if the argument is that "clip contents" should be purely graphical, maybe a second option could be added to "clip input events" or something to that effect? So both options could be used together, where necessary.

It is still happening in 3.1 stable (no mono) on X11, android and iOS.

Tried some workaround like iterating on the scroll buttons every frame and disabling the ones that are outside, but the result is not 100% correct (partial button visibility is a problem) and there is a performance hit per button to process every-frame.

This should be definitely built-in.

I just found a way to fix it. Instead of setting a clips_input variable that does not exist, you need to implement a function like this:

func _clips_input():
    return true

It works as expected, but this way is un-documented, obscure (I had to dig a lot in the C++ source), and a bit strange, compared to:

  1. Just having a variable clips_input or
  2. Make bool Control::clips_input() const return rect_clip_contents by default.
Was this page helpful?
0 / 5 - 0 ratings