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

CCLayerPanZoom: Enable and disabling touches #98

Open
praveencastelino opened this issue Feb 29, 2012 · 2 comments
Open

CCLayerPanZoom: Enable and disabling touches #98

praveencastelino opened this issue Feb 29, 2012 · 2 comments

Comments

@praveencastelino
Copy link

There are no methods to enable and disable touches.

@praveencastelino
Copy link
Author

I have used the following solution which works fine...

-(void)enableTouch:(BOOL)enable
{
if(enable)
{
[[CCTouchDispatcher sharedDispatcher] addStandardDelegate:self priority:0];
}
else
{
[[CCTouchDispatcher sharedDispatcher] removeDelegate:self];
}
}

@jtarallo
Copy link

When implementing what praveencastelino suggested, I had to in addition remove all objects from the touches array of the PanZoomLayer:

 -(void)enableTouches:(BOOL)enable
{
    [[self touches] removeAllObjects];
    if(enable)
    {
        [[CCTouchDispatcher sharedDispatcher] addStandardDelegate:self priority:0];
        CCLOG(@"LayerPanZoom enabled.");
    }
    else
    {
        [[CCTouchDispatcher sharedDispatcher] removeDelegate:self];
        CCLOG(@"LayerPanZoom disabled.");
    }
}

If I didn't it had lot's of problems when resuming touch handling.

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

No branches or pull requests

2 participants