Skip to content

Commit

Permalink
fix state emits
Browse files Browse the repository at this point in the history
  • Loading branch information
J.P.P Treub committed Mar 19, 2016
1 parent 489695d commit a85d1df
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions framer/LayerStates.coffee
Expand Up @@ -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
Expand All @@ -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



Expand Down

0 comments on commit a85d1df

Please sign in to comment.