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

Enhance ScrollView with easing out scrolling #12466

Merged
merged 23 commits into from Jun 29, 2015

Conversation

Projects
None yet
4 participants
@neokim
Contributor

neokim commented Jun 22, 2015

Enhance ScrollView with elastic scroll movement.

It becomes to have iOS-like bounce-back and elastic inertia scroll using exponential ease out of tween functions.

https://www.youtube.com/watch?v=WwYJBN1bke4

It might seem that much part of sources are changed. But it is mainly resulted by code refactoring which removed some duplicated logics. No public / protected interfaces are changed and it works well with existing components.

  • No attributes related to Cocos Studio are changed.
  • No protected interfaces used by ListView and PageView are changed. They are not changed and work well.
  • Improved maintainability. Source refactoring is done and have compact codes.
  • Test project works fine.

neokim added some commits Jun 18, 2015

Merge the logics for bouncing of VERTICAL, HORIZONTAL and BOTH in one…
… function. VERTICAL and HORIZONTAL can be processed as BOTH.
Merge branch 'feature/remove_redundant_logics' into feature/elastic_s…
…crollview

Refactor existing scroll logic before add more features. Some redundant codes are removed.
Replace the existing bounce back feature with another one like iOS bo…
…unce-back. The inner container moves smoother when bouncing back.

It does what the existing code did including scroll event dispatching and attenuating.
Merge branch 'feature/apply_new_bounce_back' into feature/elastic_scr…
…ollview

Apply the new bounce back which is iOS-like.
Separate the inertia scroll from auto scroll. And implement auto scro…
…ll and bounce back as one logic. The bounce back movement is one of auto scroll feature.
Merge branch 'feature/elastic_inertia_scroll' into feature/elastic_sc…
…rollview

Apply elastic movement to inertia scroll

@neokim neokim changed the title from Enhance ScrollView with eased-out scrolling to Enhance ScrollView with easing out scrolling Jun 22, 2015

@man2

This comment has been minimized.

Show comment
Hide comment
@man2

man2 Jun 22, 2015

really really nice feature that cocos2d-x needed most.. thanks!!

man2 commented Jun 22, 2015

really really nice feature that cocos2d-x needed most.. thanks!!

@neokim

This comment has been minimized.

Show comment
Hide comment
@neokim

neokim Jun 23, 2015

Contributor

Thanks for letting me know someone loves it. :)
Cocos2d-x is a great engine but I think that there are still some 'rooms' to be improved in terms of intuitive and attractive UX. I'm interested in filling those rooms.
This is a little contribution to it.

Anyway the request has been in pending status by auto build in 18 hours. Something wrong?

Contributor

neokim commented Jun 23, 2015

Thanks for letting me know someone loves it. :)
Cocos2d-x is a great engine but I think that there are still some 'rooms' to be improved in terms of intuitive and attractive UX. I'm interested in filling those rooms.
This is a little contribution to it.

Anyway the request has been in pending status by auto build in 18 hours. Something wrong?

@zilongshanren

This comment has been minimized.

Show comment
Hide comment
@zilongshanren

zilongshanren Jun 23, 2015

Member

@neokim The Jenkins server hang up due to run out of free space. Now it is fixed.
Thanks for your contributing.

Member

zilongshanren commented Jun 23, 2015

@neokim The Jenkins server hang up due to run out of free space. Now it is fixed.
Thanks for your contributing.

@zilongshanren

This comment has been minimized.

Show comment
Hide comment
@zilongshanren

zilongshanren Jun 23, 2015

Member

[ci rebuild]

Member

zilongshanren commented Jun 23, 2015

[ci rebuild]

@neokim

This comment has been minimized.

Show comment
Hide comment
@neokim

neokim Jun 23, 2015

Contributor

Jenkins failed by the following exception in Mac configuration. (http://45.56.80.45:8080/job/ccs-pr/1527/node=mac/console)

@AndyQue can you take a look at it?

FATAL: java.io.IOException: Unexpected termination of the channel
hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected termination of the channel
    at hudson.remoting.Request.abort(Request.java:296)
    at hudson.remoting.Channel.terminate(Channel.java:815)
    at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:69)
    at ......remote call to mac(Native Method)
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1361)
    at hudson.remoting.Request.call(Request.java:171)
    at hudson.remoting.Channel.call(Channel.java:752)
    at hudson.Launcher$RemoteLauncher.kill(Launcher.java:954)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:543)
    at hudson.model.Run.execute(Run.java:1744)
    at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:374)
Caused by: java.io.IOException: Unexpected termination of the channel
    at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:50)
Caused by: java.io.EOFException
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2325)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2794)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:801)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
    at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:40)
    at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
    at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)
Finished: FAILURE
Contributor

neokim commented Jun 23, 2015

Jenkins failed by the following exception in Mac configuration. (http://45.56.80.45:8080/job/ccs-pr/1527/node=mac/console)

@AndyQue can you take a look at it?

FATAL: java.io.IOException: Unexpected termination of the channel
hudson.remoting.RequestAbortedException: java.io.IOException: Unexpected termination of the channel
    at hudson.remoting.Request.abort(Request.java:296)
    at hudson.remoting.Channel.terminate(Channel.java:815)
    at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:69)
    at ......remote call to mac(Native Method)
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1361)
    at hudson.remoting.Request.call(Request.java:171)
    at hudson.remoting.Channel.call(Channel.java:752)
    at hudson.Launcher$RemoteLauncher.kill(Launcher.java:954)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:543)
    at hudson.model.Run.execute(Run.java:1744)
    at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:374)
Caused by: java.io.IOException: Unexpected termination of the channel
    at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:50)
Caused by: java.io.EOFException
    at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2325)
    at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2794)
    at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:801)
    at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
    at hudson.remoting.ObjectInputStreamEx.<init>(ObjectInputStreamEx.java:40)
    at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:34)
    at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:48)
Finished: FAILURE
@zilongshanren

This comment has been minimized.

Show comment
Hide comment
@zilongshanren

zilongshanren Jun 23, 2015

Member

@neokim oops, the mac slave is not stable. I think your PR is ok.
I will review it later, thanks.

Member

zilongshanren commented Jun 23, 2015

@neokim oops, the mac slave is not stable. I think your PR is ok.
I will review it later, thanks.

@pandamicro pandamicro added this to the v3.8 milestone Jun 23, 2015

@pandamicro pandamicro added the refine label Jun 23, 2015

@zilongshanren

This comment has been minimized.

Show comment
Hide comment
@zilongshanren

zilongshanren Jun 24, 2015

Member

[ci rebuild]

Member

zilongshanren commented Jun 24, 2015

[ci rebuild]

@pandamicro pandamicro added the ui label Jun 24, 2015

@pandamicro pandamicro referenced this pull request Jun 24, 2015

Closed

Refine UI system in native engine #12516

21 of 21 tasks complete

zilongshanren added some commits Jun 29, 2015

Merge branch 'v3' into v3-finish-android-9-patch-image-format
Conflicts:
	cocos/2d/libcocos2d_8_1/libcocos2d_8_1/libcocos2d_8_1.Shared/libcocos2d_8_1.Shared.vcxitems.filters
Show outdated Hide outdated cocos/ui/UIScrollView.cpp Outdated
@zilongshanren

This comment has been minimized.

Show comment
Hide comment
@zilongshanren

zilongshanren Jun 29, 2015

Why If the position of the inner container is out of the boundary, the offsets should be divided by two.? Could you explain it here? thanks.

zilongshanren commented on cocos/ui/UIScrollView.cpp in 876c94f Jun 29, 2015

Why If the position of the inner container is out of the boundary, the offsets should be divided by two.? Could you explain it here? thanks.

This comment has been minimized.

Show comment
Hide comment
@neokim

neokim Jun 29, 2015

Owner

This is one of the elastic features of iOS bounce back. When you drag the inner container, it moves as much as you drag. But if it goes out of boundary, only half of the amount you drag is affected to the inner container.

Owner

neokim replied Jun 29, 2015

This is one of the elastic features of iOS bounce back. When you drag the inner container, it moves as much as you drag. But if it goes out of boundary, only half of the amount you drag is affected to the inner container.

This comment has been minimized.

Show comment
Hide comment
@zilongshanren

zilongshanren Jun 29, 2015

I see, make sense.

zilongshanren replied Jun 29, 2015

I see, make sense.

@zilongshanren

This comment has been minimized.

Show comment
Hide comment
@zilongshanren

zilongshanren Jun 29, 2015

For this line:
(*offsetXResult) = _leftBoundary - icLeftPos;

Should we consider boundary according to bounceEnabled here? Why do you change it to _leftBoundary here?

zilongshanren commented on cocos/ui/UIScrollView.cpp in 876c94f Jun 29, 2015

For this line:
(*offsetXResult) = _leftBoundary - icLeftPos;

Should we consider boundary according to bounceEnabled here? Why do you change it to _leftBoundary here?

@zilongshanren

This comment has been minimized.

Show comment
Hide comment
@zilongshanren

zilongshanren Jun 29, 2015

Why remove these lines?

zilongshanren commented on cocos/ui/UIScrollView.cpp in 876c94f Jun 29, 2015

Why remove these lines?

This comment has been minimized.

Show comment
Hide comment
@neokim

neokim Jun 29, 2015

Owner

Those variables for bouncing boundary are not necessary any more because the new bounce back doesn't need boundary.

Owner

neokim replied Jun 29, 2015

Those variables for bouncing boundary are not necessary any more because the new bounce back doesn't need boundary.

This comment has been minimized.

Show comment
Hide comment
@zilongshanren

zilongshanren Jun 29, 2015

thanks. After spending 3 hours to review all of your commits, finally I got the idea.

zilongshanren replied Jun 29, 2015

thanks. After spending 3 hours to review all of your commits, finally I got the idea.

@zilongshanren

This comment has been minimized.

Show comment
Hide comment
@zilongshanren

zilongshanren Jun 29, 2015

What's the meaning of the magic number 0.5 here?

zilongshanren commented on cocos/ui/UIScrollView.cpp in c4fa994 Jun 29, 2015

What's the meaning of the magic number 0.5 here?

@zilongshanren

This comment has been minimized.

Show comment
Hide comment
@zilongshanren

zilongshanren Jun 29, 2015

Member

@neokim A big thanks for your contribution. 👍
You have done the refactoring which I have dreamed to refactor for month.
Now the code is more cleaner and the bouncing logic is fancy.
It's a big win for Cocos2D-X developers.
Thanks very much! :)

Member

zilongshanren commented Jun 29, 2015

@neokim A big thanks for your contribution. 👍
You have done the refactoring which I have dreamed to refactor for month.
Now the code is more cleaner and the bouncing logic is fancy.
It's a big win for Cocos2D-X developers.
Thanks very much! :)

@neokim

This comment has been minimized.

Show comment
Hide comment
@neokim

neokim Jun 29, 2015

Contributor

It was my pleasure. :)
Actually most things were already there, I just added a little feature.

Contributor

neokim commented Jun 29, 2015

It was my pleasure. :)
Actually most things were already there, I just added a little feature.

zilongshanren added a commit that referenced this pull request Jun 29, 2015

Merge pull request #12466 from neokim/feature/elastic_scrollview
Enhance ScrollView with easing out scrolling

@zilongshanren zilongshanren merged commit aa86ed9 into cocos2d:v3 Jun 29, 2015

1 check failed

Jenkins CI Build failed!
Details

@neokim neokim deleted the neokim:feature/elastic_scrollview branch Jun 29, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment