cocos2d-objc
cocos2d-objc copied to clipboard
Only forward touch events if CCResponder has user interaction enabled
With the current implementation touch events caused by an active touch will be forwarded to a CCResponder
even if the responder sets userInteractionEnabled
to NO
.
Can be reproduced with the following sequence:
- Start touch
- Set
userInteractionEnabled
toNO
- Move touch
With the current implementation touchMoved
would be called in the above example.
With the suggested change a touch event will only be forwarded if a node has userInteractionEnabled
set to YES
.
I think, that if the user disables touch handling while a touch is ongoing, there are two options
- complete the touch, as the user has already accepted it (current functionality)
- forcefully cancel touch I don’t think just stopping to respond to an ongoing touch, is the right way.
On 11 Jul 2014, at 06:40, Benjamin Encz [email protected] wrote:
With the current implementation touch events caused by an active touch will be forwarded to a CCResponder even if the responder sets userInteractionEnabled to NO.
Can be reproduced with the following sequence:
Start touch Set userInteractionEnabledto NO Move touch With the current implementation touchMoved would be called in the above example. With the suggested change a touch event will only be forwarded if a node has userInteractionEnabled set to YES.
You can merge this Pull Request by running
git pull https://github.com/Ben-G/cocos2d-iphone respondermanager_cancel_touch Or view, comment on, or merge it at:
https://github.com/cocos2d/cocos2d-iphone/pull/882
Commit Summary
only forward touch events if node has user interaction enabled File Changes
M cocos2d/CCResponderManager.m (8) Patch Links:
https://github.com/cocos2d/cocos2d-iphone/pull/882.patch https://github.com/cocos2d/cocos2d-iphone/pull/882.diff — Reply to this email directly or view it on GitHub.
Yes I was thinking about cancelling the touch as well. I would be fine with solution 2). Any other opinions on option 1) vs option 2)?