MattRix / Futile

A super simple Unity 2D framework
http://struct.ca/futile
833 stars 130 forks source link

FButton isEnabled fix. #202

Open jpsarda opened 11 years ago

jpsarda commented 11 years ago

If _isEnabled if false, we still get the HandleSingleTouchMoved and the HandleSingleTouchEnded as HandleSingleTouchBegan rightfully returns true. I just added a check of _touchDown in HandleSingleTouchMoved and HandleSingleTouchEnded to fix this.

MattRix commented 11 years ago

Hmm, I see what you're saying, although I'm not sure that the way you've fixed it is quite the right way to do it (though I think it's on the right track). _isTouchDown is basically just an indicator of whether the down element and down color should be used, not really something that's meant to be used for logical checks. I don't think checking for _isTouchDown in TouchBegan makes a lot of sense to me, unless I'm missing something here? And also your return isn't returning a boolean value.

I should note that part of the reason this issue occurs is because the FButton is intended to keep blocking touches when isEnabled is false.

jpsarda commented 11 years ago

Oops must have made an error when reporting the fix locally. The check was not supposed to be in touch began.

If touchIsDown means what it says ( touch is down ) I think that's the perfect value to check. You could create another bool property for this but it will be the exact same value as touchIsDown. Unless you have a smarter way of fixing this in mind. But yes touch began must return true to grab the touches so I don't see another simple way to fix this.

Anyway I'll commit a fix soon to see what I meant ( [edit] done )