]> git.proxmox.com Git - sencha-touch.git/blame - src/src/fx/layout/card/ScrollCover.js
import Sencha Touch 2.4.2 source
[sencha-touch.git] / src / src / fx / layout / card / ScrollCover.js
CommitLineData
c4685c84
TL
1/**
2 * @private
3 */
4Ext.define('Ext.fx.layout.card.ScrollCover', {
5 extend: 'Ext.fx.layout.card.Scroll',
6
7 alias: 'fx.layout.card.scrollcover',
8
9 onActiveItemChange: function(cardLayout, inItem, outItem, options, controller) {
10 var containerElement, containerSize, xy, animConfig,
11 inTranslate, outTranslate;
12
13 this.lastController = controller;
14 this.inItem = inItem;
15
16 if (inItem && outItem) {
17 containerElement = this.getLayout().container.innerElement;
18
19 containerSize = containerElement.getSize();
20 xy = this.calculateXY(containerSize);
21 animConfig = {
22 easing: this.getEasing(),
23 duration: this.getDuration()
24 };
25
26 inItem.renderElement.dom.style.setProperty('visibility', 'hidden', 'important');
27 inTranslate = inItem.setTranslatable(true).getTranslatable();
28 outTranslate = outItem.setTranslatable(true).getTranslatable();
29
30 outTranslate.translate({ x: 0, y: 0});
31// outItem.setTranslate(null);
32 inTranslate.translate({ x: xy.left, y: xy.top});
33 inTranslate.getWrapper().dom.style.setProperty('z-index', '100', 'important');
34 inItem.show();
35
36 inTranslate.on({
37 animationstart: 'onInAnimationStart',
38 animationend: 'onInAnimationEnd',
39 scope: this
40 });
41 inTranslate.translateAnimated({ x: 0, y: 0}, animConfig);
42
43 controller.pause();
44 }
45 },
46
47 onInAnimationStart: function() {
48 this.inItem.renderElement.dom.style.removeProperty('visibility');
49 },
50
51 onInAnimationEnd: function() {
52 this.inItem.getTranslatable().getWrapper().dom.style.removeProperty('z-index'); // Remove this when we can remove translatable
53// this.inItem.setTranslatable(null);
54 this.lastController.resume();
55 }
56});