Skip to content

Commit 5477700

Browse files
committed
Fix stop animation error
Fixed error in stopAnimation when animation has not run before.
1 parent 3381a77 commit 5477700

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Winwheel.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,11 +1689,16 @@ Winwheel.prototype.stopAnimation = function(canCallback)
16891689
// @TODO as part of multiwheel, need to work out how to stop the tween for a single wheel but allow others to continue.
16901690

16911691
// We can kill the animation using our tween object.
1692-
winwheelToDrawDuringAnimation.tween.kill();
1692+
if (winwheelToDrawDuringAnimation)
1693+
{
1694+
winwheelToDrawDuringAnimation.tween.kill();
1695+
1696+
// Call the callback function.
1697+
winwheelStopAnimation(canCallback);
1698+
}
16931699

1694-
// 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.
1700+
// Ensure the winwheelToDrawDuringAnimation is set to this class.
16951701
winwheelToDrawDuringAnimation = this;
1696-
winwheelStopAnimation(canCallback);
16971702
}
16981703

16991704
// ==================================================================================================================================================

0 commit comments

Comments
 (0)