PDA

View Full Version : [FIXED] Why does Carousel have touchend and scrollend handlers for its scroller?



orangechicken
25 Jun 2010, 10:19 AM
The scrollend handler uses the Carousel's next() and previous(), but the touchend handler just adds or subtracts the width and calls scrollTo directly. Addtionally, the touchend handler has a magic number for a drag threshold -- one that I would like to adjust, actually, because currently just about *any* drag movement (3 pixels, it seems by the magic number) results in a rotation of the carousel. This leads leads to accidental rotation. Couldn't the touchend handler be dropped?

Anyways: The best example is swiping through pages in the iPhone home screen. Drag a page of apps across the screen (past halfway) and then ever-so-slightly flick back towards your starting point and it returns to where you began. It feels very natural.

TommyMaintz
29 Jun 2010, 3:17 PM
There was a very specific reason for this. However because of the complete overhaul and refactor of the scroller, we were able to clean up the Carousel drastically. The code is much cleaner, smaller and easier to understand. Besides that it now also supports direction vertical on the Carousel.

This will be in the next release (due within an hour).

orangechicken
30 Jun 2010, 11:15 AM
Carousel now seems broken with v0.91.

The indicator shows that it's switching panes, but the content just snaps back to the first pane! Ideas?

TommyMaintz
30 Jun 2010, 11:24 AM
You are right. Something must have gone wrong in the build process. We will make sure this is fixed asap and put up a new build within the hour.

TommyMaintz
30 Jun 2010, 11:33 AM
Nevermind. For me it turned out to be a caching issue. Have you tried to clear your cache and refresh?

If it still doesnt work, could you tell me what OS and device you are running it on?

orangechicken
30 Jun 2010, 11:59 AM
My replies to this thread have been lost a couple times today: Mine was a false alarm. I just hadn't copied the new CSS over from the release.

One related item: Can the delta for switching panes become configurable? It's currently hardcoded to 3 pixels. I'd like it to be 50% of width. (Additionally, there ought to be different behavior for dragging and releasing -- handled by the current onTouchEnd -- and "flicking". The model is the iPhone springboard: A quick flick from anywhere switches pages as does touch-dragging the page past the midpoint and releasing. But they *are* separate gestures.

TommyMaintz
30 Jun 2010, 1:13 PM
Good to hear it wasnt a problem in our build.

I originally had the behavior you were describing where you drag, release and if its over the midpoint it switches cards. Then the iPad came out and I modeled our carousel behavior according to its springboard implementation. I agree it would be nice to have this be configurable and support both.

Could you add a feature request in our feature request forum describing this? Just mentioning "iPhone springboard card switching behavior for carousel" will be enough for me to understand what you want. Then we can assign it a ticket number and I can make sure this gets done.

P.S. In the meantime dont be afraid to open to source code for Ext.Carousel. It's rather simple (especially in the latest release) and it shouldn't be too hard to implement this. You can use Ext.override(Ext.Carousel, {...your overrides here...}); to change and add functionality to the Carousel. Also, if you go down this road and you get it to work, could you please share it with us? ;)