@@ -27,7 +27,7 @@ var layoutInfo = {
2727 top : function ( d ) { return Math . floor ( d . idx / cardsPerRow ) * 90 + 'px' } ,
2828 left : function ( d ) { return ( d . idx % cardsPerRow ) * 200 + 'px' } ,
2929 headerOpacity : 0 ,
30- headerLeft : '-650px' ,
30+ headerLeft : - 650 ,
3131 c1Top : 10 ,
3232 c1Left : 10 ,
3333 c1FontSize : 18 ,
@@ -78,28 +78,30 @@ function sort(key){
7878
7979function layout ( sel ) {
8080 var l = getLayoutInfo ( curStyle ) ;
81+ var t = d3 . transition ( )
82+ . duration ( animTime )
8183
8284 sel . style ( 'left' , l . left )
8385 . style ( 'top' , l . top )
8486 . style ( 'height' , l . height )
8587 . style ( 'width' , l . width )
8688 . style ( 'border-radius' , l . radius ) ;
8789
88- d3 . selectAll ( '.c1' ) . transition ( ) . duration ( animTime )
90+ d3 . selectAll ( '.c1' ) . transition ( t )
8991 . style ( 'top' , l . c1Top )
9092 . style ( 'left' , l . c1Left )
9193 . style ( 'font-size' , l . c1FontSize ) ;
92- d3 . selectAll ( '.c2' ) . transition ( ) . duration ( animTime )
94+ d3 . selectAll ( '.c2' ) . transition ( t )
9395 . style ( 'top' , l . c2Top )
9496 . style ( 'left' , l . c2Left ) ;
9597
96- d3 . select ( '.header' ) . transition ( ) . duration ( animTime )
98+ d3 . select ( '.header' ) . transition ( t )
9799 . style ( 'opacity' , l . headerOpacity )
98100 . style ( 'left' , l . headerLeft ) ;
99101
100- var totalHeight = ( curStyle === 'card' ?
102+ var totalHeight = 20 + ( curStyle === 'card' ?
101103 Math . ceil ( data . length / cardsPerRow ) * 90
102- : 40 + data . length * 29 ) + 20 ;
103- d3 . select ( '.holder' ) . transition ( ) . duration ( animTime )
104+ : 40 + data . length * 29 ) ;
105+ d3 . select ( '.holder' ) . transition ( t )
104106 . style ( 'height' , totalHeight ) ;
105107}
0 commit comments