@@ -166,7 +166,7 @@ function sceneUpdate(gd, subplot) {
166
166
var scene = subplot . _scene ;
167
167
var fullLayout = gd . _fullLayout ;
168
168
169
- var reset = {
169
+ var resetOpts = {
170
170
// number of traces in subplot, since scene:subplot → 1:1
171
171
count : 0 ,
172
172
// whether scene requires init hook in plot call (dirty plot call)
@@ -181,7 +181,7 @@ function sceneUpdate(gd, subplot) {
181
181
errorYOptions : [ ]
182
182
} ;
183
183
184
- var first = {
184
+ var initOpts = {
185
185
selectBatch : null ,
186
186
unselectBatch : null ,
187
187
// regl- component stubs, initialized in dirty plot call
@@ -193,7 +193,11 @@ function sceneUpdate(gd, subplot) {
193
193
} ;
194
194
195
195
if ( ! subplot . _scene ) {
196
- scene = subplot . _scene = Lib . extendFlat ( { } , reset , first ) ;
196
+ scene = subplot . _scene = { } ;
197
+
198
+ scene . init = function init ( ) {
199
+ Lib . extendFlat ( scene , initOpts , resetOpts ) ;
200
+ } ;
197
201
198
202
// apply new option to all regl components (used on drag)
199
203
scene . update = function update ( opt ) {
@@ -306,7 +310,7 @@ function sceneUpdate(gd, subplot) {
306
310
307
311
// In case if we have scene from the last calc - reset data
308
312
if ( ! scene . dirty ) {
309
- Lib . extendFlat ( scene , reset ) ;
313
+ Lib . extendFlat ( scene , resetOpts ) ;
310
314
}
311
315
312
316
return scene ;
@@ -328,10 +332,7 @@ function plot(gd, subplot, cdata) {
328
332
329
333
var success = prepareRegl ( gd , [ 'ANGLE_instanced_arrays' , 'OES_element_index_uint' ] ) ;
330
334
if ( ! success ) {
331
- scene . error2d = false ;
332
- scene . line2d = false ;
333
- scene . scatter2d = false ;
334
- scene . fill2d = false ;
335
+ scene . init ( ) ;
335
336
return ;
336
337
}
337
338
0 commit comments