The solution I went with was to do another layer of checking on any touch outide the rect we're currently looking at, and if this other touch is on a button, we can ignore it. This way we'll turn arrows off both if you drag a finger into the other arrow, and if you drag that finger out of the arrow area entirely. The only downside here is that a random tap, near the top of the screen for instance, will make both arrows false. But, I might reasonably ask, what were you doing tapping up there anyway, that's not where the controls are... the menu UI elements are already responding OK to touch, so hopefully this won't break those. I guess we'll find out. Anyway, the extra code is here:
bool OrphanTouch(Vector2 screenPos)
{
bool isOrphan = false;
if
//don't count the other arrows for this
(!greenButton.Contains(screenPos) &&
!yellowButton.Contains(screenPos))
{
isOrphan = true;
}
return isOrphan;
}
No comments:
Post a Comment