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 | function TransitionController(plt, _config) {
|
10 | this.plt = plt;
|
11 | this._config = _config;
|
12 | this._ids = 0;
|
13 | this._trns = {};
|
14 | }
|
15 | TransitionController.prototype.getRootTrnsId = function (nav) {
|
16 | nav = nav.parent;
|
17 | while (nav) {
|
18 | if (isPresent(nav._trnsId)) {
|
19 | return nav._trnsId;
|
20 | }
|
21 | nav = nav.parent;
|
22 | }
|
23 | return null;
|
24 | };
|
25 | TransitionController.prototype.nextId = function () {
|
26 | return this._ids++;
|
27 | };
|
28 | TransitionController.prototype.get = function (trnsId, enteringView, leavingView, opts) {
|
29 | var TransitionClass = this._config.getTransition(opts.animation);
|
30 | if (!TransitionClass) {
|
31 |
|
32 | TransitionClass = this._config.getTransition('ios-transition');
|
33 | }
|
34 | var trns = new TransitionClass(this.plt, enteringView, leavingView, opts);
|
35 | trns.trnsId = trnsId;
|
36 | if (!this._trns[trnsId]) {
|
37 |
|
38 | this._trns[trnsId] = trns;
|
39 | }
|
40 | else {
|
41 |
|
42 |
|
43 | this._trns[trnsId].add(trns);
|
44 | }
|
45 | return trns;
|
46 | };
|
47 | TransitionController.prototype.destroy = function (trnsId) {
|
48 | var trans = this._trns[trnsId];
|
49 | if (trans) {
|
50 | trans.destroy();
|
51 | delete this._trns[trnsId];
|
52 | }
|
53 | };
|
54 | TransitionController.decorators = [
|
55 | { type: Injectable },
|
56 | ];
|
57 |
|
58 | TransitionController.ctorParameters = function () { return [
|
59 | { type: Platform, },
|
60 | { type: Config, },
|
61 | ]; };
|
62 | return TransitionController;
|
63 | }());
|
64 | export { TransitionController };
|
65 |
|
\ | No newline at end of file |