1 | var __extends = (this && this.__extends) || (function () {
|
2 | var extendStatics = Object.setPrototypeOf ||
|
3 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
4 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
5 | return function (d, b) {
|
6 | extendStatics(d, b);
|
7 | function __() { this.constructor = d; }
|
8 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
9 | };
|
10 | })();
|
11 | import { Animation } from '../animations/animation';
|
12 | import { isPresent } from '../util/util';
|
13 | import { PageTransition } from './page-transition';
|
14 | var SHOW_BACK_BTN_CSS = 'show-back-button';
|
15 | var SCALE_SMALL = .95;
|
16 | var WPTransition = (function (_super) {
|
17 | __extends(WPTransition, _super);
|
18 | function WPTransition() {
|
19 | return _super !== null && _super.apply(this, arguments) || this;
|
20 | }
|
21 | WPTransition.prototype.init = function () {
|
22 | _super.prototype.init.call(this);
|
23 | var plt = this.plt;
|
24 | var enteringView = this.enteringView;
|
25 | var leavingView = this.leavingView;
|
26 | var opts = this.opts;
|
27 |
|
28 | var backDirection = (opts.direction === 'back');
|
29 | if (enteringView) {
|
30 | if (backDirection) {
|
31 | this.duration(isPresent(opts.duration) ? opts.duration : 120).easing('cubic-bezier(0.47,0,0.745,0.715)');
|
32 | this.enteringPage.beforeClearStyles(['scale']);
|
33 | }
|
34 | else {
|
35 | this.duration(isPresent(opts.duration) ? opts.duration : 280).easing('cubic-bezier(0,0,0.05,1)');
|
36 | this.enteringPage
|
37 | .fromTo('scale', SCALE_SMALL, 1, true)
|
38 | .fromTo('opacity', 0.01, 1, true);
|
39 | }
|
40 | if (enteringView.hasNavbar()) {
|
41 | var enteringPageEle = enteringView.pageRef().nativeElement;
|
42 | var enteringNavbarEle = enteringPageEle.querySelector('ion-navbar');
|
43 | var enteringNavBar = new Animation(plt, enteringNavbarEle);
|
44 | this.add(enteringNavBar);
|
45 | var enteringBackButton = new Animation(plt, enteringNavbarEle.querySelector('.back-button'));
|
46 | this.add(enteringBackButton);
|
47 | if (enteringView.enableBack()) {
|
48 | enteringBackButton.beforeAddClass(SHOW_BACK_BTN_CSS);
|
49 | }
|
50 | else {
|
51 | enteringBackButton.beforeRemoveClass(SHOW_BACK_BTN_CSS);
|
52 | }
|
53 | }
|
54 | }
|
55 |
|
56 | if (leavingView && backDirection) {
|
57 |
|
58 | this.duration(opts.duration || 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
|
59 | var leavingPage = new Animation(plt, leavingView.pageRef());
|
60 | this.add(leavingPage.fromTo('scale', 1, SCALE_SMALL).fromTo('opacity', 0.99, 0));
|
61 | }
|
62 | };
|
63 | return WPTransition;
|
64 | }(PageTransition));
|
65 | export { WPTransition };
|
66 |
|
\ | No newline at end of file |