Skip to content
Permalink
Browse files

fix state emits

  • Loading branch information...
J.P.P Treub
J.P.P Treub committed Mar 19, 2016
1 parent 489695d commit a85d1df5811c949865672f020457222cac3eeff8
Showing with 3 additions and 3 deletions.
  1. +3 −3 framer/LayerStates.coffee
@@ -107,7 +107,7 @@ class exports.LayerStates extends BaseClass
if instant is true
# We want to switch immediately without animation
@layer.props = properties
@emit Events.StateDidSwitch, _.last(@_previousStates), stateName, @
@emit Events.StateDidSwitch, _.last(@_previousStates), @_currentState, @

else
# Start the animation and update the state when finished
@@ -116,13 +116,13 @@ class exports.LayerStates extends BaseClass

@_animation?.stop()
@_animation = @layer.animate animationOptions
@_animation.on "stop", =>
@_animation.once "stop", =>

# Set all the values for keys that we couldn't animate
for k, v of properties
@layer[k] = v unless _.isNumber(v) or Color.isColorObject(v)

@emit(Events.StateDidSwitch, _.last(@_previousStates), stateName, @) unless _.last(@_previousStates) is stateName
@emit(Events.StateDidSwitch, _.last(@_previousStates), @_currentState, @) unless _.last(@_previousStates) is stateName



0 comments on commit a85d1df

Please sign in to comment.
You can’t perform that action at this time.