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

ScrollLayer always bounces back when content height is less than winSize height #1

Open
hactar opened this issue Jul 9, 2013 · 0 comments

Comments

@hactar
Copy link

hactar commented Jul 9, 2013

Nice class, works well, but found a bug.

I'm trying to create a horizontal scrolllayer which is wider than the screen (600 points), but only 150 points high (less than the windowSize). When I do this the scrolllayer always bounces back, even though theres still content to be scrolled.

Code (this sets the height of the content to be 1 less then the winSize):

    AScrollLayer *scrollLayer = [AScrollLayer node];

    //scrollLayer.horizontalScrollDisabled = YES;
    scrollLayer.verticalScrollDisabled = YES;
    scrollLayer.contentSize = CGSizeMake(600, [[CCDirector sharedDirector] winSize].height-1);
    [self addChild:scrollLayer];
    //[scrollLayer setRelativePosition:ccp(50, 50) type:kCCBPositionTypePercent];


    CCLayerColor *colorLayer = [CCLayerColor layerWithColor:ccc4(255, 0, 0, 255) width:600 height:[[CCDirector sharedDirector] winSize].height-1];
    colorLayer.anchorPoint = CGPointZero;
    [scrollLayer.contentLayer addChild:colorLayer];

Expected result:
ScrollLayer should scroll horizontally for a bit as 200 pixels are outside the iphone4s screen

Actual result:
ScrollLayer immediately bounces back.

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

1 participant