@@ -166,7 +166,7 @@ function sceneUpdate(gd, subplot) {
166166 var scene = subplot . _scene ;
167167 var fullLayout = gd . _fullLayout ;
168168
169- var reset = {
169+ var resetOpts = {
170170 // number of traces in subplot, since scene:subplot → 1:1
171171 count : 0 ,
172172 // whether scene requires init hook in plot call (dirty plot call)
@@ -181,7 +181,7 @@ function sceneUpdate(gd, subplot) {
181181 errorYOptions : [ ]
182182 } ;
183183
184- var first = {
184+ var initOpts = {
185185 selectBatch : null ,
186186 unselectBatch : null ,
187187 // regl- component stubs, initialized in dirty plot call
@@ -193,7 +193,11 @@ function sceneUpdate(gd, subplot) {
193193 } ;
194194
195195 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+ } ;
197201
198202 // apply new option to all regl components (used on drag)
199203 scene . update = function update ( opt ) {
@@ -306,7 +310,7 @@ function sceneUpdate(gd, subplot) {
306310
307311 // In case if we have scene from the last calc - reset data
308312 if ( ! scene . dirty ) {
309- Lib . extendFlat ( scene , reset ) ;
313+ Lib . extendFlat ( scene , resetOpts ) ;
310314 }
311315
312316 return scene ;
@@ -328,10 +332,7 @@ function plot(gd, subplot, cdata) {
328332
329333 var success = prepareRegl ( gd , [ 'ANGLE_instanced_arrays' , 'OES_element_index_uint' ] ) ;
330334 if ( ! success ) {
331- scene . error2d = false ;
332- scene . line2d = false ;
333- scene . scatter2d = false ;
334- scene . fill2d = false ;
335+ scene . init ( ) ;
335336 return ;
336337 }
337338
0 commit comments