Skip to content

Commit

Permalink
fix(Controller): check phase before doing pause/resume effects
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson committed May 12, 2020
1 parent af0bf03 commit 57f59f2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/core/src/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,10 @@ export class Controller<State extends Lookup = Lookup>
/** Freeze the active animation in time */
pause(keys?: OneOrMore<string>) {
if (is.und(keys)) {
this._phase = PAUSED
flushCalls(this._state.pauseQueue)
if (!this.is(PAUSED)) {
this._phase = PAUSED
flushCalls(this._state.pauseQueue)
}
this.each(spring => spring.pause())
} else {
const springs = this.springs as Lookup<SpringValue>
Expand All @@ -173,8 +175,10 @@ export class Controller<State extends Lookup = Lookup>
/** Resume the animation if paused. */
resume(keys?: OneOrMore<string>) {
if (is.und(keys)) {
this._phase = this._active.size ? ACTIVE : IDLE
flushCalls(this._state.resumeQueue)
if (this.is(PAUSED)) {
this._phase = this._active.size ? ACTIVE : IDLE
flushCalls(this._state.resumeQueue)
}
this.each(spring => spring.resume())
} else {
const springs = this.springs as Lookup<SpringValue>
Expand Down

0 comments on commit 57f59f2

Please sign in to comment.