Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: vexir on April 21, 2015, 05:59:24 PM

Title: Button Hover-Off, Hover-On Bug
Post by: vexir on April 21, 2015, 05:59:24 PM
NGUI seems to not register button clicks if I hold down, move my mouse/touch point off the button, and then back on and release.

Video for illustration:

https://www.youtube.com/watch?v=jb3Pl-ROXX0

Is this intended behavior? Because it feels like a strange bug to me.

Thanks :)
Title: Re: Button Hover-Off, Hover-On Bug
Post by: ArenMook on April 22, 2015, 02:21:39 PM
Yes, it's the intended behaviour. Once you start dragging it turns into a drag operation -- even more so when you leave the button's region. The click event is canceled at that point.
Title: Re: Button Hover-Off, Hover-On Bug
Post by: vexir on April 22, 2015, 02:25:58 PM
Hm - I can understand the reasoning behind the functionality. I think the visual is flawed then - it feels like the button shouldn't change to it's pressed state again when you drag back onto it. It sends a visual signal that I'm ready to be pressed, and then feels like a bug when it doesn't perform it's function. I associate the pressed state with "I'm about to do the thing I'm supposed to do."

Additionally, I wonder if it's contributing to a bug I'm seeing - users will press a button and occasionally have it not do anything, despite the pressed state being shown. At first I thought the collider was shrinking with the UIButtonScale script, but I wrote a separate one that doesn't and I still see the issue. Could it be that with a button that's just small enough, a drag operation is triggered by the incident sliding of the finger when you tap the button with too much force?

It makes it pretty frustrating for users to get around some of my buttons. Obviously I can make them bigger and hopefully that address the issue, but it doesn't seem like the way it should work - not to mention if they pressed the button near the edges, they might still run into the issue if their finger slides off the edge of the button unwittingly.
Title: Re: Button Hover-Off, Hover-On Bug
Post by: ArenMook on April 22, 2015, 02:34:07 PM
You can just change your logic to respond to OnPress(false) instead of OnClick() if you need it.

Alternatively check the code for UIButton/UIButtonColor and remove the part where it reacts to OnDragOver.
Title: Re: Button Hover-Off, Hover-On Bug
Post by: vexir on April 22, 2015, 02:54:57 PM
Changing it to OnPress would remove the user's ability to drag off and cancel the input, which is something they might be used to after using standard PC interfaces. I'll probably modify the part where it reacts to OnDragOver - is there a quick way to have it cancel the touch if no longer on the button itself, but still activate if the touch comes back over the button?

Also, generally how do you feel about my first comment - that its perhaps misleading/unintuitive that the button still gets depressed even though it's not going to activate after a drag-off-drag-on?
Title: Re: Button Hover-Off, Hover-On Bug
Post by: ArenMook on April 24, 2015, 07:31:33 AM
You can cancel the click notification like so:
UICamera.currentTouch.clickNotification = UICamera.ClickNotification.None;

However there is no way to "cancel" a touch.