fix: fix UIButton not releasing when enabled #64
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a
UIButton
is disabled whilst the mouse is being held over it, then theUIButton
will still act as pressed even if the mouse button is released when it is re-enabled. The same applies if you release the button whilst it is disabled. The button only becomes un-pressed when you click it again. I have added a reproduction of this bug to my NUISamples project. The gif below shows this.Destination Sol on Android has several buttons that are used to control the player ship (touch screen controls). These buttons are typically held, rather than pressed, to indicate that an action should be taken (see MovingBlocks/DestinationSol#588). When using NUI buttons to control the player ship, this issue is particually pronouced.
This pull request slightly adjusts the interaction region logic for buttons. It ensures that the interaction region is still present if the button is in the
down
state and then correspondingly only enables the button on mouse release if the button is enabled.