1 | import { Injectable } from '@angular/core';
|
2 | import { Config } from '../config/config';
|
3 | import { isPresent } from '../util/util';
|
4 | import { Platform } from '../platform/platform';
|
5 |
|
6 |
|
7 |
|
8 | var TransitionController = (function () {
|
9 | |
10 |
|
11 |
|
12 |
|
13 | function TransitionController(plt, _config) {
|
14 | this.plt = plt;
|
15 | this._config = _config;
|
16 | this._ids = 0;
|
17 | this._trns = {};
|
18 | }
|
19 | |
20 |
|
21 |
|
22 |
|
23 | TransitionController.prototype.getRootTrnsId = function (nav) {
|
24 | nav = (nav.parent);
|
25 | while (nav) {
|
26 | if (isPresent(nav._trnsId)) {
|
27 | return nav._trnsId;
|
28 | }
|
29 | nav = nav.parent;
|
30 | }
|
31 | return null;
|
32 | };
|
33 | |
34 |
|
35 |
|
36 | TransitionController.prototype.nextId = function () {
|
37 | return this._ids++;
|
38 | };
|
39 | |
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | TransitionController.prototype.get = function (trnsId, enteringView, leavingView, opts) {
|
47 | var TransitionClass = this._config.getTransition(opts.animation);
|
48 | if (!TransitionClass) {
|
49 |
|
50 | TransitionClass = this._config.getTransition('ios-transition');
|
51 | }
|
52 | var trns = new TransitionClass(this.plt, enteringView, leavingView, opts);
|
53 | trns.trnsId = trnsId;
|
54 | if (!this._trns[trnsId]) {
|
55 |
|
56 | this._trns[trnsId] = trns;
|
57 | }
|
58 | else {
|
59 |
|
60 |
|
61 | this._trns[trnsId].add(trns);
|
62 | }
|
63 | return trns;
|
64 | };
|
65 | |
66 |
|
67 |
|
68 |
|
69 | TransitionController.prototype.destroy = function (trnsId) {
|
70 | var trans = this._trns[trnsId];
|
71 | if (trans) {
|
72 | trans.destroy();
|
73 | delete this._trns[trnsId];
|
74 | }
|
75 | };
|
76 | return TransitionController;
|
77 | }());
|
78 | export { TransitionController };
|
79 | TransitionController.decorators = [
|
80 | { type: Injectable },
|
81 | ];
|
82 |
|
83 |
|
84 |
|
85 | TransitionController.ctorParameters = function () { return [
|
86 | { type: Platform, },
|
87 | { type: Config, },
|
88 | ]; };
|
89 | function TransitionController_tsickle_Closure_declarations() {
|
90 |
|
91 | TransitionController.decorators;
|
92 | |
93 |
|
94 |
|
95 |
|
96 | TransitionController.ctorParameters;
|
97 |
|
98 | TransitionController.prototype._ids;
|
99 |
|
100 | TransitionController.prototype._trns;
|
101 |
|
102 | TransitionController.prototype.plt;
|
103 |
|
104 | TransitionController.prototype._config;
|
105 | }
|
106 |
|
\ | No newline at end of file |