PDA

View Full Version : cardswitch event not always triggered when there is animation.



hotdp
1 Jul 2011, 2:38 AM
Sencha Touch version tested:

1.1.0

only default ext-all.css




Platform tested against:

iOS 3.x
iOS 4
Android 2.1
Android 2.2
Safari browser



Description:

If I scroll fast on a list and pres itemTap, setActive item to a new panel with animation like 'slide' the cardswitch is not always triggered. If i scroll, pause and press, the event is triggered. If i scroll and pres the item fast the event is not triggered.




Steps to reproduce the problem:

A Panel with cardlayout that contains one list.
Inside the List there is a itemtap Event where you setActiveItem on the main panel with animation like 'slide' to a new panel.
Scroll fast on the list and press a item.
It will go the new Panel but the event will not be triggered.

quasiobject
11 Jul 2011, 1:01 PM
I've experienced a similar issue. Testing an Android 2.1 build on a Droid and 'cardswitch' doesn't fire at all (doesn't matter with speed of scrolling or pressing). I had to use 'beforecardswitch' instead.

Unlike the report above, I can get it to work in Safari, Chrome and Mobile Safari (iPod Touch 1st gen, iOS 3.1.3)

hotdp
12 Jul 2011, 8:53 AM
I've experienced a similar issue. Testing an Android 2.1 build on a Droid and 'cardswitch' doesn't fire at all (doesn't matter with speed of scrolling or pressing). I had to use 'beforecardswitch' instead.

Unlike the report above, I can get it to work in Safari, Chrome and Mobile Safari (iPod Touch 1st gen, iOS 3.1.3)

What did you do to get it to work? or did it just work for you?

I use the event to destroy the card i was comming from, so i don't belive i can use beforecardswitch? But as you said, that event works every time... Or i could "hack" it with a timer? :S

I hope you or someone has a workaround to my problem until the event works as it should?

hotdp
19 Jul 2011, 11:10 PM
I have a update:

if (oldCard) {
Ext.Anim.run(oldCard, animation, {
out: true,
autoClear: true,
after: function() {
console.log('oldcard anumation done');

oldCard.fireEvent('deactivate', oldCard, newCard);
if (me.hideInactive && me.activeItem != oldCard) {
oldCard.hide();
}

// We fire onCardSwitch in the after of the oldCard animation
// because that is the last one to fire, and we want to make sure
// both animations are finished before firing it.
owner.onCardSwitch(newCard, oldCard, newIndex, true);
}
});
}
the console output is NEVER there when i scroll fast in the list and pres a item. So the problem is there but i don't know how to fix it?

hotdp
1 Aug 2011, 12:04 PM
Update:

When I use setActiveItem, I will start a new animation, so "sencha" removes all old animations on that panel before I start a new animation.
But the animations will not reset the child elements.
So when the animation on the scrollbar (list is scrolling) is done it will send the event (webkit). BUT this results in the onTransitionComplete never will be run on oldPanel's handler.