Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only forward touch events if CCResponder has user interaction enabled #882

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Ben-G
Copy link
Contributor

@Ben-G Ben-G commented Jul 11, 2014

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.

@Birkemose
Copy link
Contributor

I think, that if the user disables touch handling while a touch is ongoing, there are two options

  1. complete the touch, as the user has already accepted it (current functionality)
  2. 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:

#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.

@Ben-G
Copy link
Contributor Author

Ben-G commented Jul 11, 2014

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants