Giter Site home page Giter Site logo

schmittsfn / ascrolllayer Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 1.0 1.83 MB

This is an attempt to create an open source alternative to UIScrollView by implementing it as a cocos2d layer. The idea is to make it fully featured (e.g. rubber band, smooth scrolling).

License: MIT License

Objective-C 87.03% C 12.70% Objective-C++ 0.24% CMake 0.02%
objective-c cocos2d scrolling

ascrolllayer's Introduction

░█▀▀░█▀▄░█░░░░█▀▄▀█░░▀░░▀█▀░▀█▀░█▀▀░█▀▀░█▀▀▄
░▀▀▄░█░░░█▀▀█░█░▀░█░░█▀░░█░░░█░░▀▀▄░█▀░░█░▒█
░▀▀▀░▀▀▀░▀░░▀░▀░░▒▀░▀▀▀░░▀░░░▀░░▀▀▀░▀░░░▀░░▀

0xc yrs writing software

Programming Languages:
∙ Swift
∙ Objective-C
∙ C++
Core Technologies:
∙ SwiftUI
∙ Combine
∙ CarPlay
∙ tvOS
∙ Core Data
∙ Core Graphics
Cloud & Backend:
∙ Firebase
∙ AWS
∙ Heroku
∙ DigitalOcean
Design & Collaboration:
∙ Figma
∙ Jira
∙ Trello
∙ Notion
∙ Slack

ascrolllayer's People

Contributors

schmittsfn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

talgat777

ascrolllayer's Issues

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

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.