@@ -17,7 +17,6 @@ var Registry = require('../registry');
1717var Lib = require ( '../lib' ) ;
1818var Color = require ( '../components/color' ) ;
1919var plots = module . exports = { } ;
20- var transitionAttrs = require ( './transition_attributes' ) ;
2120var animationAttrs = require ( './animation_attributes' ) ;
2221var frameAttrs = require ( './frame_attributes' ) ;
2322
@@ -616,6 +615,8 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout) {
616615} ;
617616
618617plots . supplyAnimationDefaults = function ( opts ) {
618+ opts = opts || { } ;
619+ var i ;
619620 var optsOut = { } ;
620621
621622 function coerce ( attr , dflt ) {
@@ -624,24 +625,53 @@ plots.supplyAnimationDefaults = function(opts) {
624625
625626 coerce ( 'immediate' ) ;
626627
628+ if ( Array . isArray ( opts . frame ) ) {
629+ optsOut . frame = [ ] ;
630+ for ( i = 0 ; i < opts . frame . length ; i ++ ) {
631+ optsOut . frame [ i ] = plots . supplyAnimationFrameDefaults ( opts . frame [ i ] || { } ) ;
632+ }
633+ } else {
634+ optsOut . frame = plots . supplyAnimationFrameDefaults ( opts . frame || { } ) ;
635+ }
636+
637+ if ( Array . isArray ( opts . transition ) ) {
638+ optsOut . transition = [ ] ;
639+ for ( i = 0 ; i < opts . transition . length ; i ++ ) {
640+ optsOut . transition [ i ] = plots . supplyAnimationTransitionDefaults ( opts . transition [ i ] || { } ) ;
641+ }
642+ } else {
643+ optsOut . transition = plots . supplyAnimationTransitionDefaults ( opts . transition || { } ) ;
644+ }
645+
627646 return optsOut ;
628647} ;
629648
630- plots . supplyTransitionDefaults = function ( opts ) {
649+ plots . supplyAnimationFrameDefaults = function ( opts ) {
631650 var optsOut = { } ;
632651
633652 function coerce ( attr , dflt ) {
634- return Lib . coerce ( opts || { } , optsOut , transitionAttrs , attr , dflt ) ;
653+ return Lib . coerce ( opts || { } , optsOut , animationAttrs . frame , attr , dflt ) ;
635654 }
636655
637- coerce ( 'frameduration' ) ;
638- coerce ( 'transitionduration' ) ;
639- coerce ( 'ease' ) ;
656+ coerce ( 'duration' ) ;
640657 coerce ( 'redraw' ) ;
641658
642659 return optsOut ;
643660} ;
644661
662+ plots . supplyAnimationTransitionDefaults = function ( opts ) {
663+ var optsOut = { } ;
664+
665+ function coerce ( attr , dflt ) {
666+ return Lib . coerce ( opts || { } , optsOut , animationAttrs . transition , attr , dflt ) ;
667+ }
668+
669+ coerce ( 'duration' ) ;
670+ coerce ( 'easing' ) ;
671+
672+ return optsOut ;
673+ } ;
674+
645675plots . supplyFrameDefaults = function ( frameIn ) {
646676 var frameOut = { } ;
647677
@@ -1316,11 +1346,8 @@ plots.computeFrame = function(gd, frameName) {
13161346 * @param {string id or DOM element } gd
13171347 * the id or DOM element of the graph container div
13181348 */
1319- plots . transition = function ( gd , data , layout , traceIndices , transitionOpts ) {
1349+ plots . transition = function ( gd , data , layout , traceIndices , frameOpts , transitionOpts ) {
13201350 var i , traceIdx ;
1321- var fullLayout = gd . _fullLayout ;
1322-
1323- transitionOpts = plots . supplyTransitionDefaults ( transitionOpts ) ;
13241351
13251352 var dataLength = Array . isArray ( data ) ? data . length : 0 ;
13261353
@@ -1371,10 +1398,14 @@ plots.transition = function(gd, data, layout, traceIndices, transitionOpts) {
13711398 // This step fies the .xaxis and .yaxis references that otherwise
13721399 // aren't updated by the supplyDefaults step:
13731400 var subplots = Plotly . Axes . getSubplots ( gd ) ;
1374- for ( i = 0 ; i < subplots . length ; i ++ ) {
1375- plotinfo = gd . _fullLayout . _plots [ subplots [ i ] ] ;
1376- plotinfo . xaxis = plotinfo . x ( ) ;
1377- plotinfo . yaxis = plotinfo . y ( ) ;
1401+
1402+ // Polar does not have _plots:
1403+ if ( gd . _fullLayout . _plots ) {
1404+ for ( i = 0 ; i < subplots . length ; i ++ ) {
1405+ plotinfo = gd . _fullLayout . _plots [ subplots [ i ] ] ;
1406+ plotinfo . xaxis = plotinfo . x ( ) ;
1407+ plotinfo . yaxis = plotinfo . y ( ) ;
1408+ }
13781409 }
13791410
13801411 plots . doCalcdata ( gd ) ;
@@ -1410,7 +1441,7 @@ plots.transition = function(gd, data, layout, traceIndices, transitionOpts) {
14101441 // When instantaneous updates are coming through quickly, it's too much to simply disable
14111442 // all interaction, so store this flag so we can disambiguate whether mouse interactions
14121443 // should be fully disabled or not:
1413- if ( transitionOpts . transitionduration > 0 ) {
1444+ if ( transitionOpts . duration > 0 ) {
14141445 gd . _transitioningWithDuration = true ;
14151446 }
14161447
@@ -1435,7 +1466,7 @@ plots.transition = function(gd, data, layout, traceIndices, transitionOpts) {
14351466
14361467 var traceTransitionOpts ;
14371468 var j ;
1438- var basePlotModules = fullLayout . _basePlotModules ;
1469+ var basePlotModules = gd . _fullLayout . _basePlotModules ;
14391470 var hasAxisTransition = false ;
14401471
14411472 if ( layout ) {
@@ -1452,7 +1483,7 @@ plots.transition = function(gd, data, layout, traceIndices, transitionOpts) {
14521483 // to instantaneous.
14531484 if ( hasAxisTransition ) {
14541485 traceTransitionOpts = Lib . extendFlat ( { } , transitionOpts ) ;
1455- traceTransitionOpts . transitionduration = 0 ;
1486+ traceTransitionOpts . duration = 0 ;
14561487 } else {
14571488 traceTransitionOpts = transitionOpts ;
14581489 }
@@ -1475,7 +1506,7 @@ plots.transition = function(gd, data, layout, traceIndices, transitionOpts) {
14751506 flushCallbacks ( gd . _transitionData . _interruptCallbacks ) ;
14761507
14771508 return Promise . resolve ( ) . then ( function ( ) {
1478- if ( transitionOpts . redraw ) {
1509+ if ( frameOpts . redraw ) {
14791510 return Plotly . redraw ( gd ) ;
14801511 }
14811512 } ) . then ( function ( ) {
0 commit comments