@@ -1558,10 +1558,25 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts)
15581558 gd . _transitioningWithDuration = true ;
15591559 }
15601560
1561+
1562+ // If another transition is triggered, this callback will be executed simply because it's
1563+ // in the interruptCallbacks queue. If this transition completes, it will instead flush
1564+ // that queue and forget about this callback.
15611565 gd . _transitionData . _interruptCallbacks . push ( function ( ) {
15621566 aborted = true ;
15631567 } ) ;
15641568
1569+ if ( frameOpts . redraw ) {
1570+ gd . _transitionData . _interruptCallbacks . push ( function ( ) {
1571+ return Plotly . redraw ( gd ) ;
1572+ } ) ;
1573+ }
1574+
1575+ // Emit this and make sure it happens last:
1576+ gd . _transitionData . _interruptCallbacks . push ( function ( ) {
1577+ gd . emit ( 'plotly_transitioninterrupted' , [ ] ) ;
1578+ } ) ;
1579+
15651580 // Construct callbacks that are executed on transition end. This ensures the d3 transitions
15661581 // are *complete* before anything else is done.
15671582 var numCallbacks = 0 ;
@@ -1633,14 +1648,11 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts)
16331648 }
16341649
16351650 function interruptPreviousTransitions ( ) {
1636- gd . emit ( 'plotly_transitioninterrupted' , [ ] ) ;
1637-
16381651 // If a transition is interrupted, set this to false. At the moment, the only thing that would
16391652 // interrupt a transition is another transition, so that it will momentarily be set to true
16401653 // again, but this determines whether autorange or dragbox work, so it's for the sake of
16411654 // cleanliness:
16421655 gd . _transitioning = false ;
1643- gd . _transtionWithDuration = false ;
16441656
16451657 return executeCallbacks ( gd . _transitionData . _interruptCallbacks ) ;
16461658 }
0 commit comments