View Full Version : Carousel 'slide' logic

30 Oct 2010, 8:43 AM

On the Carousel, if we use the animation 'slide' when setting the card, I think the Carousel should check the relation between the current card and the card is is setting to an animate accordingly. Right now, it always animates from the same side meaning that it break common logic on how the Carousel works via the user touch (left to right and right to left).

IE: If I am on card 5 and want to set to card 3 it should animated from left to right. Right now, they all animate from right to left no matter the card number.

I looked around and didn't see a setting for this, so I am reporting it, if I am mistaken, please let me know!
(I had to implement a fake animation to make it work as wanted, but built it would be better)


30 Oct 2010, 6:25 PM
the TabPanel has this logic. If you click a tab that is before the current tab it will slide from the left.

You can specify the animation and insert your own logic in the time being.

var currIndex = carousel.getActiveIndex(),
direction = "right";
if (currIndex > newIndex) {
direction = "left"
carousel.setCard(newIndex, {type : "slide", direction : direction});

I just typed that out from the top of my head so I may of gotten the direction variable backwards.

31 Oct 2010, 6:23 AM
Thanks, I already implemented something similar, I was just reporting the desire for this logic to be built in as it should be.

31 Oct 2010, 6:38 AM
Then this post should be moved to the correct forum. I think it should be built into the CardLayout really. Then anything that uses CardLayout will benefit. Abstraction!

31 Oct 2010, 9:23 AM
I wasn't sure where I should put it since I wanted to confirm that it was something that was lacking from it.

Are you on the Sencha Touch team? If so, where should I put this under a bug or feature request?

31 Oct 2010, 9:34 AM
I'm not part of the Sencha team... yet :-) but this isn't really a bug IMHO so I think it would be a feature request.