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

Change BaseButton.keep_pressed_outside behavior to reflect the signal emission in addition to visual appearance #2645

Open
Xioor opened this issue Apr 24, 2021 · 9 comments · May be fixed by godotengine/godot#48871

Comments

@Xioor
Copy link

Xioor commented Apr 24, 2021

Describe the project you are working on

Mobile game template

Describe the problem or limitation you are having in your project

Pressing a button, then dragging outside the button while still pressing and then releasing outside the button causes a buttonUp anyways.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

keep_pressed_outside in BaseButton seems wrong in my opinion. In the documentation, it says: Note: This property only affects the button's visual appearance. Signals will be emitted at the same moment regardless of this property's value.

I think it should also stop signals as the name implies. Unless it's renamed keep_visually_pressed_outside or something but I have seen a few other peoples having issues with keeping buttons not pressed when you press and drag away from the button and release. They have to do weird logic to satisfy that logic.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Don't Signal button pressed when keep_pressed_outside is false and you released outside the button.

If this enhancement will not be used often, can it be worked around with a few lines of script?

It should be easy enough to change this logic and the documentations. Let me know if you want me to implement it.

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

It is in the core code.

@Calinou
Copy link
Member

Calinou commented Apr 24, 2021

See also godotengine/godot#37790.

@Calinou Calinou changed the title keep_pressed_outside seems wrong in BaseButton Change BaseButton.keep_pressed_outside behavior Apr 24, 2021
@AaronRecord
Copy link

Pressing a button, then dragging outside the button while still pressing and then releasing outside the button causes a buttonUp anyways.

I don't think this is always true, I had issues with it not getting called when implementing godotengine/godot#47538, which is why I make it capture the mouse instead

@Xioor
Copy link
Author

Xioor commented May 1, 2021

See also godotengine/godot#37790.

Seems like I have the same issue that they had. I still think it's incorrect for this member to only effect the visual of the button, but not the logic of it.

@Xioor
Copy link
Author

Xioor commented May 8, 2021

@Calinou How does the logistics work for fixing bugs in Godot? Is this something that would be voted on as a team or do people just fix the issues they find and open a pr?

@AaronRecord
Copy link

How does the logistics work for fixing bugs in Godot? Is this something that would be voted on as a team or do people just fix the issues they find and open a pr?

Anyone can open a PR, and if it gets approved then it can get merged

@Calinou Calinou changed the title Change BaseButton.keep_pressed_outside behavior Change BaseButton.keep_pressed_outside behavior to reflect the signal emission in addition to visual appearance May 10, 2021
@Xioor
Copy link
Author

Xioor commented May 19, 2021

I think I got something working, testing on iOS. How do I recompile the engine for Android?

@Calinou
Copy link
Member

Calinou commented May 19, 2021

I think I got something working, testing on iOS. How do I recompile the engine for Android?

See Compiling for Android in the documentation.

@Xioor Xioor linked a pull request May 20, 2021 that will close this issue
@Xioor
Copy link
Author

Xioor commented May 20, 2021

godotengine/godot#48871

@chucklepie
Copy link

Hello, I have this behaviour on my buttons but I have noticed that on moving the mouse outside the button it is not resetting the texture of the button, i.e. keep_pressed_outside is not working.

However, this confused me because I created a basic sample scene with a button and it does work properly and on releasing outside the pressed button signal is not raised, which contracticts what the documentation says 'this property only affects the visual appearance... signals will still be emitted'.

I think clarification on whether releasing outside raises a signal or not? Either way, I think the issue is nested container related.

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

Successfully merging a pull request may close this issue.

4 participants