@@ -46,10 +46,13 @@ exports.plot = function plotGl3d(gd) {
46
46
for ( var i = 0 ; i < sceneIds . length ; i ++ ) {
47
47
var sceneId = sceneIds [ i ] ,
48
48
fullSceneData = Plots . getSubplotData ( fullData , 'gl3d' , sceneId ) ,
49
- scene = fullLayout [ sceneId ] . _scene ; // ref. to corresp. Scene instance
49
+ sceneLayout = fullLayout [ sceneId ] ,
50
+ scene = sceneLayout . _scene ;
50
51
51
52
// If Scene is not instantiated, create one!
52
53
if ( scene === undefined ) {
54
+ initAxes ( gd , sceneLayout ) ;
55
+
53
56
scene = new Scene ( {
54
57
id : sceneId ,
55
58
graphDiv : gd ,
@@ -60,10 +63,11 @@ exports.plot = function plotGl3d(gd) {
60
63
fullLayout
61
64
) ;
62
65
63
- fullLayout [ sceneId ] . _scene = scene ; // set ref to Scene instance
66
+ // set ref to Scene instance
67
+ sceneLayout . _scene = scene ;
64
68
}
65
69
66
- scene . plot ( fullSceneData , fullLayout , gd . layout ) ; // takes care of business
70
+ scene . plot ( fullSceneData , fullLayout , gd . layout ) ;
67
71
}
68
72
} ;
69
73
@@ -91,18 +95,10 @@ exports.cleanId = function cleanId(id) {
91
95
92
96
exports . setConvert = require ( './set_convert' ) ;
93
97
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 ] ;
101
101
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 ;
107
103
}
108
- } ;
104
+ }
0 commit comments