@@ -660,128 +660,3 @@ lib.numSeparate = function(value, separators, separatethousands) {
660
660
661
661
return x1 + x2 ;
662
662
} ;
663
-
664
- /*
665
- * Compute a keyframe. Merge a keyframe into its base frame(s) and
666
- * expand properties.
667
- *
668
- * @param {object } frameLookup
669
- * An object containing frames keyed by name (i.e. gd._transitionData._frameHash)
670
- * @param {string } frame
671
- * The name of the keyframe to be computed
672
- *
673
- * Returns: a new object with the merged content
674
- */
675
- lib . computeFrame = function ( frameLookup , frameName ) {
676
- var i , traceIndices , traceIndex , expandedObj , destIndex , copy ;
677
-
678
- var framePtr = frameLookup [ frameName ] ;
679
-
680
- // Return false if the name is invalid:
681
- if ( ! framePtr ) {
682
- return false ;
683
- }
684
-
685
- var frameStack = [ framePtr ] ;
686
- var frameNameStack = [ framePtr . name ] ;
687
-
688
- // Follow frame pointers:
689
- while ( ( framePtr = frameLookup [ framePtr . baseFrame ] ) ) {
690
- // Avoid infinite loops:
691
- if ( frameNameStack . indexOf ( framePtr . name ) !== - 1 ) break ;
692
-
693
- frameStack . push ( framePtr ) ;
694
- frameNameStack . push ( framePtr . name ) ;
695
- }
696
-
697
- // A new object for the merged result:
698
- var result = { } ;
699
-
700
- // Merge, starting with the last and ending with the desired frame:
701
- while ( ( framePtr = frameStack . pop ( ) ) ) {
702
- if ( framePtr . layout ) {
703
- copy = lib . extendDeepNoArrays ( { } , framePtr . layout ) ;
704
- expandedObj = lib . expandObjectPaths ( copy ) ;
705
- result . layout = lib . extendDeepNoArrays ( result . layout || { } , expandedObj ) ;
706
- }
707
-
708
- if ( framePtr . data ) {
709
- if ( ! result . data ) {
710
- result . data = [ ] ;
711
- }
712
- traceIndices = framePtr . traceIndices ;
713
-
714
- if ( ! traceIndices ) {
715
- // If not defined, assume serial order starting at zero
716
- traceIndices = [ ] ;
717
- for ( i = 0 ; i < framePtr . data . length ; i ++ ) {
718
- traceIndices [ i ] = i ;
719
- }
720
- }
721
-
722
- if ( ! result . traceIndices ) {
723
- result . traceIndices = [ ] ;
724
- }
725
-
726
- for ( i = 0 ; i < framePtr . data . length ; i ++ ) {
727
- // Loop through this frames data, find out where it should go,
728
- // and merge it!
729
- traceIndex = traceIndices [ i ] ;
730
- if ( traceIndex === undefined || traceIndex === null ) {
731
- continue ;
732
- }
733
-
734
- destIndex = result . traceIndices . indexOf ( traceIndex ) ;
735
- if ( destIndex === - 1 ) {
736
- destIndex = result . data . length ;
737
- result . traceIndices [ destIndex ] = traceIndex ;
738
- }
739
-
740
- copy = lib . extendDeepNoArrays ( { } , framePtr . data [ i ] ) ;
741
- expandedObj = lib . expandObjectPaths ( copy ) ;
742
- result . data [ destIndex ] = lib . extendDeepNoArrays ( result . data [ destIndex ] || { } , expandedObj ) ;
743
- }
744
- }
745
- }
746
-
747
- return result ;
748
- } ;
749
-
750
- /**
751
- * Interleaves separate trace updates (frames) into a restyle command.
752
- * Attributes not specified in both traces are set to `undefined` so that
753
- * they are not altered by restyle. Object paths are *not* expanded.
754
- *
755
- * @example
756
- * lib.interleaveTraceUpdates([{x: [1]}, {x: [2]}])
757
- * // returns {x: [[1], [2]]}
758
- *
759
- * @param {array } traces the trace updates to be interleaved
760
- *
761
- * @return {object } an object contianing the interleaved properties
762
- */
763
- lib . interleaveTraceUpdates = function ( traces ) {
764
- var i , j , k , prop , trace , props ;
765
- var n = traces . length ;
766
- var output = { } ;
767
-
768
- for ( i = 0 ; i < traces . length ; i ++ ) {
769
- trace = traces [ i ] ;
770
- props = Object . keys ( trace ) ;
771
- for ( j = 0 ; j < props . length ; j ++ ) {
772
- prop = props [ j ] ;
773
- if ( ! output [ prop ] ) {
774
- // If not present, allocate a new array:
775
- output [ prop ] = [ ] ;
776
-
777
- // Explicitly fill this array with undefined:
778
- for ( k = 0 ; k < n ; k ++ ) {
779
- output [ prop ] [ k ] = undefined ;
780
- }
781
- }
782
- output [ prop ] [ i ] = traces [ i ] [ prop ] ;
783
- }
784
- }
785
-
786
- return output ;
787
- } ;
0 commit comments