@@ -1558,10 +1558,25 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts)
1558
1558
gd . _transitioningWithDuration = true ;
1559
1559
}
1560
1560
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.
1561
1565
gd . _transitionData . _interruptCallbacks . push ( function ( ) {
1562
1566
aborted = true ;
1563
1567
} ) ;
1564
1568
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
+
1565
1580
// Construct callbacks that are executed on transition end. This ensures the d3 transitions
1566
1581
// are *complete* before anything else is done.
1567
1582
var numCallbacks = 0 ;
@@ -1633,14 +1648,11 @@ plots.transition = function(gd, data, layout, traces, frameOpts, transitionOpts)
1633
1648
}
1634
1649
1635
1650
function interruptPreviousTransitions ( ) {
1636
- gd . emit ( 'plotly_transitioninterrupted' , [ ] ) ;
1637
-
1638
1651
// If a transition is interrupted, set this to false. At the moment, the only thing that would
1639
1652
// interrupt a transition is another transition, so that it will momentarily be set to true
1640
1653
// again, but this determines whether autorange or dragbox work, so it's for the sake of
1641
1654
// cleanliness:
1642
1655
gd . _transitioning = false ;
1643
- gd . _transtionWithDuration = false ;
1644
1656
1645
1657
return executeCallbacks ( gd . _transitionData . _interruptCallbacks ) ;
1646
1658
}
0 commit comments