Permalink
Browse files

Switching to the current state directly after switchTo is called, ins…

…tead of after state switch
  • Loading branch information...
nvh committed Oct 10, 2016
1 parent 6384ea9 commit 8027175152894536c9347b5b2e7f52f3091b97a4
Showing with 5 additions and 3 deletions.
  1. +1 −1 framer/Layer.coffee
  2. +4 −2 framer/LayerStateMachine.coffee
View
@@ -932,8 +932,8 @@ class exports.Layer extends BaseClass
states = _.flatten(args)
if _.isObject(_.last(states))
options = states.pop()
-
@animate(@states.machine.next(states), options)
+
stateSwitch: (stateName, options={}) ->
unless stateName?
throw new Error("Missing required argument 'stateName' in stateSwitch()")
@@ -57,9 +57,8 @@ class exports.LayerStateMachine extends BaseClass
onStart = =>
@emit(Events.StateSwitchStart, stateNameA, stateNameB, @)
+
onStop = =>
- @_previousNames.push(stateNameA)
- @_currentName = stateNameB
@emit(Events.StateSwitchStop, stateNameA, stateNameB, @)
onEnd = =>
@@ -78,6 +77,9 @@ class exports.LayerStateMachine extends BaseClass
animation.start() if startAnimation
+ @_previousNames.push(stateNameA)
+ @_currentName = stateNameB
+
return animation
next: (states) ->

0 comments on commit 8027175

Please sign in to comment.