Skip to content

Commit

Permalink
Fix stop animation error
Browse files Browse the repository at this point in the history
Fixed error in stopAnimation when animation has not run before.
  • Loading branch information
zarocknz committed Oct 20, 2016
1 parent 3381a77 commit 5477700
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Winwheel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1689,11 +1689,16 @@ Winwheel.prototype.stopAnimation = function(canCallback)
// @TODO as part of multiwheel, need to work out how to stop the tween for a single wheel but allow others to continue.

// We can kill the animation using our tween object.
winwheelToDrawDuringAnimation.tween.kill();
if (winwheelToDrawDuringAnimation)
{
winwheelToDrawDuringAnimation.tween.kill();

// Call the callback function.
winwheelStopAnimation(canCallback);
}

// We should still call the external function to stop the wheel being redrawn even click and also callback any function that is supposed to be.
// Ensure the winwheelToDrawDuringAnimation is set to this class.
winwheelToDrawDuringAnimation = this;
winwheelStopAnimation(canCallback);
}

// ==================================================================================================================================================
Expand Down

0 comments on commit 5477700

Please sign in to comment.