@@ -598,29 +598,28 @@ function cleanLayout(layout) {
598598 * Clean up Scene layouts
599599 */
600600 var sceneIds = Plots . getSubplotIds ( layout , 'gl3d' ) ;
601- var scene , cameraposition , rotation ,
602- radius , center , mat , eye ;
603- for ( i = 0 ; i < sceneIds . length ; i ++ ) {
604- scene = layout [ sceneIds [ i ] ] ;
605-
606- /*
607- * Clean old Camera coords
608- */
609- cameraposition = scene . cameraposition ;
610- if ( Array . isArray ( cameraposition ) && cameraposition [ 0 ] . length === 4 ) {
611- rotation = cameraposition [ 0 ] ;
612- center = cameraposition [ 1 ] ;
613- radius = cameraposition [ 2 ] ;
614- mat = m4FromQuat ( [ ] , rotation ) ;
615- eye = [ ] ;
616- for ( j = 0 ; j < 3 ; ++ j ) {
601+ for ( i = 0 ; i < sceneIds . length ; i ++ ) {
602+ var scene = layout [ sceneIds [ i ] ] ;
603+
604+ // clean old Camera coords
605+ var cameraposition = scene . cameraposition ;
606+ if ( Array . isArray ( cameraposition ) && cameraposition [ 0 ] . length === 4 ) {
607+ var rotation = cameraposition [ 0 ] ,
608+ center = cameraposition [ 1 ] ,
609+ radius = cameraposition [ 2 ] ,
610+ mat = m4FromQuat ( [ ] , rotation ) ,
611+ eye = [ ] ;
612+
613+ for ( j = 0 ; j < 3 ; ++ j ) {
617614 eye [ j ] = center [ i ] + radius * mat [ 2 + 4 * j ] ;
618615 }
616+
619617 scene . camera = {
620618 eye : { x : eye [ 0 ] , y : eye [ 1 ] , z : eye [ 2 ] } ,
621619 center : { x : center [ 0 ] , y : center [ 1 ] , z : center [ 2 ] } ,
622620 up : { x : mat [ 1 ] , y : mat [ 5 ] , z : mat [ 9 ] }
623621 } ;
622+
624623 delete scene . cameraposition ;
625624 }
626625 }
0 commit comments