@@ -273,9 +273,6 @@ function sceneUpdate(gd, subplot) {
273
273
// traces in no-selection mode
274
274
scene . scatter2d . draw ( i ) ;
275
275
}
276
- if ( scene . glText [ i ] && scene . textOptions [ i ] ) {
277
- scene . glText [ i ] . render ( ) ;
278
- }
279
276
}
280
277
281
278
// draw traces in selection mode
@@ -284,6 +281,12 @@ function sceneUpdate(gd, subplot) {
284
281
scene . scatter2d . draw ( scene . unselectBatch ) ;
285
282
}
286
283
284
+ for ( i = 0 ; i < scene . count ; i ++ ) {
285
+ if ( scene . glText [ i ] && scene . textOptions [ i ] ) {
286
+ scene . glText [ i ] . render ( ) ;
287
+ }
288
+ }
289
+
287
290
scene . dirty = false ;
288
291
} ;
289
292
@@ -301,24 +304,13 @@ function sceneUpdate(gd, subplot) {
301
304
( height - vpSize . t ) - ( 1 - yaxis . domain [ 1 ] ) * vpSize . h
302
305
] ;
303
306
304
- var gl , regl ;
305
-
306
307
if ( scene . select2d ) {
307
- regl = scene . select2d . regl ;
308
- gl = regl . _gl ;
309
- gl . enable ( gl . SCISSOR_TEST ) ;
310
- gl . scissor ( vp [ 0 ] , vp [ 1 ] , vp [ 2 ] - vp [ 0 ] , vp [ 3 ] - vp [ 1 ] ) ;
311
- gl . clearColor ( 0 , 0 , 0 , 0 ) ;
312
- gl . clear ( gl . COLOR_BUFFER_BIT ) ;
308
+ clearViewport ( scene . select2d , vp ) ;
313
309
}
314
-
315
310
if ( scene . scatter2d ) {
316
- regl = scene . scatter2d . regl ;
317
- gl = regl . _gl ;
318
- gl . enable ( gl . SCISSOR_TEST ) ;
319
- gl . scissor ( vp [ 0 ] , vp [ 1 ] , vp [ 2 ] - vp [ 0 ] , vp [ 3 ] - vp [ 1 ] ) ;
320
- gl . clearColor ( 0 , 0 , 0 , 0 ) ;
321
- gl . clear ( gl . COLOR_BUFFER_BIT ) ;
311
+ clearViewport ( scene . scatter2d , vp ) ;
312
+ } else if ( scene . glText ) {
313
+ clearViewport ( scene . glText [ 0 ] , vp ) ;
322
314
}
323
315
} ;
324
316
@@ -361,6 +353,13 @@ function sceneUpdate(gd, subplot) {
361
353
return scene ;
362
354
}
363
355
356
+ function clearViewport ( comp , vp ) {
357
+ var gl = comp . regl . _gl ;
358
+ gl . enable ( gl . SCISSOR_TEST ) ;
359
+ gl . scissor ( vp [ 0 ] , vp [ 1 ] , vp [ 2 ] - vp [ 0 ] , vp [ 3 ] - vp [ 1 ] ) ;
360
+ gl . clearColor ( 0 , 0 , 0 , 0 ) ;
361
+ gl . clear ( gl . COLOR_BUFFER_BIT ) ;
362
+ }
364
363
365
364
function plot ( gd , subplot , cdata ) {
366
365
if ( ! cdata . length ) return ;
0 commit comments