Skip to content

Commit

Permalink
feat(nav): iOS swipe to go back
Browse files Browse the repository at this point in the history
Closes #5185
  • Loading branch information
adamdbradley committed Feb 17, 2016
1 parent ae17e7f commit da37029
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 236 deletions.
24 changes: 12 additions & 12 deletions ionic/animations/animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export class Animation {

// set the async TRANSITION END event
// and run onFinishes when the transition ends
self._asyncEnd(duration);
self._asyncEnd(duration, true);

// begin each animation when everything is rendered in their place
// and the transition duration/easing is ready to go
Expand Down Expand Up @@ -275,7 +275,7 @@ export class Animation {

// since there was no animation, it's done
// fire off all the onFinishes
self._onFinish();
self._onFinish(true);
}
}

Expand All @@ -299,7 +299,7 @@ export class Animation {

// set the async TRANSITION END event
// and run onFinishes when the transition ends
self._asyncEnd(duration);
self._asyncEnd(duration, false);

} else {
// this animation does not have a duration, so it should not animate
Expand All @@ -308,23 +308,23 @@ export class Animation {

// since there was no animation, it's done
// fire off all the onFinishes
self._onFinish();
self._onFinish(false);
}
}

_asyncEnd(duration: number) {
_asyncEnd(duration: number, shouldComplete: boolean) {
var self = this;

function onTransitionEnd(ev) {
console.debug('Animation async end,', (ev ? 'transitionEnd event' : 'fallback timeout'));
console.debug('Animation async end,', (ev ? 'transitionEnd, ' + ev.target.nodeName + ', property: ' + ev.propertyName : 'fallback timeout'));

// ensure transition end events and timeouts have been cleared
self._clearAsync();

// set the after styles
self._after();
self._willChange(false);
self._onFinish();
self._onFinish(shouldComplete);
}

// set the TRANSITION END event on one of the transition elements
Expand Down Expand Up @@ -580,12 +580,12 @@ export class Animation {
// for example, the left menu was dragged all the way open already
this._after();
this._willChange(false);
this._onFinish();
this._onFinish(shouldComplete);

} else {
// the stepValue was left off at a point when it needs to finish transition still
// for example, the left menu was opened 75% and needs to finish opening
this._asyncEnd(64);
this._asyncEnd(64, shouldComplete);

// force quick duration, linear easing
this._setTrans(64, true);
Expand All @@ -611,15 +611,15 @@ export class Animation {
return this;
}

_onFinish() {
_onFinish(hasCompleted: boolean) {
this.isPlaying = false;
var i;

for (i = 0; i < this._fFns.length; i++) {
this._fFns[i]();
this._fFns[i](hasCompleted);
}
for (i = 0; i < this._fOnceFns.length; i++) {
this._fOnceFns[i]();
this._fOnceFns[i](hasCompleted);
}
this._fOnceFns = [];
}
Expand Down
Loading

0 comments on commit da37029

Please sign in to comment.