@@ -46,10 +46,13 @@ exports.plot = function plotGl3d(gd) {
4646 for ( var i = 0 ; i < sceneIds . length ; i ++ ) {
4747 var sceneId = sceneIds [ i ] ,
4848 fullSceneData = Plots . getSubplotData ( fullData , 'gl3d' , sceneId ) ,
49- scene = fullLayout [ sceneId ] . _scene ; // ref. to corresp. Scene instance
49+ sceneLayout = fullLayout [ sceneId ] ,
50+ scene = sceneLayout . _scene ;
5051
5152 // If Scene is not instantiated, create one!
5253 if ( scene === undefined ) {
54+ initAxes ( gd , sceneLayout ) ;
55+
5356 scene = new Scene ( {
5457 id : sceneId ,
5558 graphDiv : gd ,
@@ -60,10 +63,11 @@ exports.plot = function plotGl3d(gd) {
6063 fullLayout
6164 ) ;
6265
63- fullLayout [ sceneId ] . _scene = scene ; // set ref to Scene instance
66+ // set ref to Scene instance
67+ sceneLayout . _scene = scene ;
6468 }
6569
66- scene . plot ( fullSceneData , fullLayout , gd . layout ) ; // takes care of business
70+ scene . plot ( fullSceneData , fullLayout , gd . layout ) ;
6771 }
6872} ;
6973
@@ -91,18 +95,10 @@ exports.cleanId = function cleanId(id) {
9195
9296exports . setConvert = require ( './set_convert' ) ;
9397
94- exports . initAxes = function ( gd ) {
95- var fullLayout = gd . _fullLayout ;
96- var sceneIds = Plots . getSubplotIds ( fullLayout , 'gl3d' ) ;
97-
98- for ( var i = 0 ; i < sceneIds . length ; ++ i ) {
99- var sceneId = sceneIds [ i ] ;
100- var sceneLayout = fullLayout [ sceneId ] ;
98+ function initAxes ( gd , sceneLayout ) {
99+ for ( var j = 0 ; j < 3 ; ++ j ) {
100+ var axisName = axesNames [ j ] ;
101101
102- for ( var j = 0 ; j < 3 ; ++ j ) {
103- var axisName = axesNames [ j ] ;
104- var ax = sceneLayout [ axisName ] ;
105- ax . _gd = gd ;
106- }
102+ sceneLayout [ axisName ] . _gd = gd ;
107103 }
108- } ;
104+ }
0 commit comments