Permalink
Browse files

Fix bugs when many new screens get inserted at once

  • Loading branch information...
koenbok committed Nov 30, 2016
1 parent 8276a2f commit 93705beecfde0f5fa61aadf272d93a1e5f3fe7c7
Showing with 6 additions and 4 deletions.
  1. +2 −0 framer/AnimationGroup.coffee
  2. +4 −4 framer/Components/NavComponent.coffee
@@ -7,6 +7,7 @@ class AnimationGroup extends BaseClass
constructor: (args...) ->
super
@_animations = _.flatten(args)
@stopAnimations = true
@stop()
start: ->
@@ -45,6 +46,7 @@ class AnimationGroup extends BaseClass
_stop: ->
return unless @_started
return unless @stopAnimations is true
@_started.map (a) -> a.stop() if a.isAnimating
_onStart: -> @emit(Events.AnimationStart)
@@ -128,7 +128,7 @@ class exports.NavComponent extends Layer
# If this is the first layer we navigate to, we skip the animation
options = _.defaults {}, options,
animate: if @_stack.length then true else false
animate: if @_firstTransition is true then true else false
scroll: true
modal: false
@@ -279,7 +279,6 @@ class exports.NavComponent extends Layer
return scroll
_wrappedLayer: (layer) ->
# Get the ScrollComponent for a layer if it was wrapped,
# or just the layer itself if it was not.
@@ -295,6 +294,7 @@ class exports.NavComponent extends Layer
# ignoreEvents to be false at the moment of a click.
Utils.delay 0, =>
@_firstTransition = true
transition[direction] animate, =>
@emit(Events.TransitionEnd, from, to, {direction: direction, modal: @isModal})
@@ -315,8 +315,6 @@ class exports.NavComponent extends Layer
animations = []
options = {instant: not animate}
if layerA and template.layerA
layerA.visible = true
animations.push(new Animation(layerA, template.layerA.hide, options))
@@ -371,6 +369,8 @@ class exports.NavComponent extends Layer
animations.push(new Animation(layerB, template.layerB.hide, options))
group = new AnimationGroup(animations)
group.stopAnimations = false
forwardEvents(group, "back")
group.once(Events.AnimationStop, callback)

0 comments on commit 93705be

Please sign in to comment.