Skip to content

Commit

Permalink
Allow animations to run for display:none elements.
Browse files Browse the repository at this point in the history
If a `layoutPositions()` animation is cancelled for a `display:none` node, then its animation promise will not resolve.  That prevents `layoutstop` from being emitted.  While it doesn't provide much value to animate the style properties of an element when it's invisible, it may make sense for some use cases to animate its position.  Allowing animations on invisible elements also has the benefit of resolving this issue in a simple way.

The downside is that you lose some performance when you ask the library to animate invisible elements to no visual effect (#1522).  Then again, you get exactly what you ask for.

Refs. : Backport 3.14.x : layoutstop event not triggered when a node is not displayed #2700 #2693
  • Loading branch information
maxkfranz committed May 29, 2020
1 parent 6b5201a commit a0a0eef
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/core/animation/step-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ function stepAll( now, cy ){
let queue = _p.animation.queue;
let ranAnis = false;

// cancel all animations on display:none ele
if( !isCore && ele.pstyle('display').value === 'none' ){
// put all current and queue animations in this tick's current list
// and empty the lists for the element
current = current.splice( 0, current.length ).concat( queue.splice( 0, queue.length ) );

// stop all animations
for( let i = 0; i < current.length; i++ ){ current[i].stop(); }
}

// if nothing currently animating, get something from the queue
if( current.length === 0 ){
let next = queue.shift();
Expand Down

0 comments on commit a0a0eef

Please sign in to comment.