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

GUI: make mouse_filter default to PASS and explicitly set to STOP when required. #881

Closed
TheDuriel opened this issue May 24, 2020 · 2 comments

Comments

@TheDuriel
Copy link

Describe the project you are working on:

Describe the problem or limitation you are having in your project:
Currently Control.mouse_filter defaults to MOUSE_FILTER_STOP. This means Mouse Inputs will not pass through the Node unless the user manually changes this behavior. Some Control nodes explicitly set this property, like Container which sets this to MOUSE_FILTER_PASS. (Or PanelContainer which sets it to MOUSE_FILTER_STOP, with this comment: // Has visible stylebox, so stop by default.)

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
I propose to change the default behavior to MOUSE_FILTER_PASS, and to explicitly set to MOUSE_FILTER_STOP in Nodes where Input would be expected to stop. (Button, Text and Line Edit, ScrollBar, Tabs, and PanelContainer, etc.)

This would also mean that Nodes such as: Panel, ColorRect, TextureRect, and more, would Pass Mouse Input on, instead of blocking them.

I believe this change to be desirable due to my contributions in supporting the community, mainly discord, by answering help requests. One of the common struggles for people trying to build UI scenes, is that nodes will expectantly prevent Mouse Inputs from propagating. This problem can often be hard to spot, in many cases the blocking Control has no visuals, or the user set a Opague texture to use as an overlay.

An argument can be made that "Solid" Controls such as ColorRect or Panel should default to Stopping Input. But I find that Passing often does not lead to problems, and is more easily noticed when troubleshooting. (Its easier to tell why something IS happening, than why something IS NOT happening.)

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
The relevant property can be set in the constructor of each affected Class. I've tried this with a number of Control nodes and it seems to cause no immediate problems even in the Editor.

If this enhancement will not be used often, can it be worked around with a few lines of script?:
The Goal is to bring the behavior in line with Expectations.

Is there a reason why this should be core and not an add-on in the asset library?:

TL:DR: Make Control Nodes default to Pass mouse inputs instead of Stopping it which can lead to inexpected behavior.

@Xrayez
Copy link
Contributor

Xrayez commented May 24, 2020

See slightly different proposal at #788.

@Calinou
Copy link
Member

Calinou commented May 25, 2020

Duplicate of #788. Please discuss whether the default mode should be Pass or Ignore there.

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