@@ -192,7 +192,7 @@ function render(scene) {
192
192
scene . drawAnnotations ( scene ) ;
193
193
}
194
194
195
- function tryCreatePlot ( scene , camera , pixelRatio , canvas , gl ) {
195
+ function tryCreatePlot ( scene , cameraObject , pixelRatio , canvas , gl ) {
196
196
197
197
var glplotOptions = {
198
198
canvas : canvas ,
@@ -204,7 +204,7 @@ function tryCreatePlot(scene, camera, pixelRatio, canvas, gl) {
204
204
snapToData : true ,
205
205
autoScale : true ,
206
206
autoBounds : false ,
207
- camera : camera ,
207
+ cameraObject : cameraObject ,
208
208
pixelRatio : pixelRatio
209
209
} ;
210
210
@@ -238,9 +238,11 @@ function tryCreatePlot(scene, camera, pixelRatio, canvas, gl) {
238
238
return true ;
239
239
}
240
240
241
- function initializeGLPlot ( scene , camera , pixelRatio , canvas , gl ) {
241
+ function initializeGLPlot ( scene , pixelRatio , canvas , gl ) {
242
242
243
- var success = tryCreatePlot ( scene , camera , pixelRatio , canvas , gl ) ;
243
+ scene . initializeGLCamera ( ) ;
244
+
245
+ var success = tryCreatePlot ( scene , scene . camera , pixelRatio , canvas , gl ) ;
244
246
/*
245
247
* createPlot will throw when webgl is not enabled in the client.
246
248
* Lets return an instance of the module with all functions noop'd.
@@ -281,8 +283,6 @@ function initializeGLPlot(scene, camera, pixelRatio, canvas, gl) {
281
283
} , false ) ;
282
284
}
283
285
284
- if ( ! scene . camera ) scene . initializeGLCamera ( ) ;
285
-
286
286
scene . glplot . camera = scene . camera ;
287
287
288
288
scene . glplot . oncontextloss = function ( ) {
@@ -351,9 +351,7 @@ function Scene(options, fullLayout) {
351
351
this . convertAnnotations = Registry . getComponentMethod ( 'annotations3d' , 'convert' ) ;
352
352
this . drawAnnotations = Registry . getComponentMethod ( 'annotations3d' , 'draw' ) ;
353
353
354
- var camera = fullLayout . scene . camera ;
355
-
356
- initializeGLPlot ( this , camera , this . pixelRatio ) ;
354
+ initializeGLPlot ( this , this . pixelRatio ) ;
357
355
358
356
this . enableGLCameraMouseListener ( ) ;
359
357
}
@@ -808,7 +806,7 @@ proto.setCamera = function setCamera(cameraData) {
808
806
809
807
this . glplot . dispose ( ) ;
810
808
811
- initializeGLPlot ( this , cameraData , pixelRatio ) ;
809
+ initializeGLPlot ( this , pixelRatio ) ;
812
810
this . glplot . camera . _ortho = newOrtho ;
813
811
}
814
812
} ;
0 commit comments