@@ -242,7 +242,7 @@ function sceneUpdate(gd, subplot) {
242242 if ( scene . error2d ) scene . error2d . update ( opts . concat ( opts ) ) ;
243243 if ( scene . select2d ) scene . select2d . update ( opts ) ;
244244 if ( scene . glText ) {
245- for ( i = 0 ; i < scene . glText . length ; i ++ ) {
245+ for ( i = 0 ; i < scene . count ; i ++ ) {
246246 scene . glText [ i ] . update ( opts [ i ] ) ;
247247 }
248248 }
@@ -273,6 +273,9 @@ function sceneUpdate(gd, subplot) {
273273 // traces in no-selection mode
274274 scene . scatter2d . draw ( i ) ;
275275 }
276+ if ( scene . glText [ i ] && scene . textOptions [ i ] ) {
277+ scene . glText [ i ] . render ( ) ;
278+ }
276279 }
277280
278281 // draw traces in selection mode
@@ -281,12 +284,6 @@ function sceneUpdate(gd, subplot) {
281284 scene . scatter2d . draw ( scene . unselectBatch ) ;
282285 }
283286
284- if ( scene . glText . length ) {
285- scene . glText . forEach ( function ( text ) {
286- text . render ( ) ;
287- } ) ;
288- }
289-
290287 scene . dirty = false ;
291288 } ;
292289
@@ -333,9 +330,7 @@ function sceneUpdate(gd, subplot) {
333330 if ( scene . line2d ) scene . line2d . destroy ( ) ;
334331 if ( scene . select2d ) scene . select2d . destroy ( ) ;
335332 if ( scene . glText ) {
336- scene . glText . forEach ( function ( text ) {
337- text . destroy ( ) ;
338- } ) ;
333+ scene . glText . forEach ( function ( text ) { text . destroy ( ) ; } ) ;
339334 }
340335
341336 scene . lineOptions = null ;
@@ -409,15 +404,15 @@ function plot(gd, subplot, cdata) {
409404 scene . fill2d = createLine ( regl ) ;
410405 }
411406 if ( scene . glText === true ) {
412- scene . glText = [ ] ;
413- for ( i = 0 ; i < scene . textOptions . length ; i ++ ) {
407+ scene . glText = new Array ( scene . count ) ;
408+ for ( i = 0 ; i < scene . count ; i ++ ) {
414409 scene . glText [ i ] = new Text ( regl ) ;
415410 }
416411 }
417412
418413 // update main marker options
419414 if ( scene . glText ) {
420- for ( i = 0 ; i < scene . textOptions . length ; i ++ ) {
415+ for ( i = 0 ; i < scene . count ; i ++ ) {
421416 scene . glText [ i ] . update ( scene . textOptions [ i ] ) ;
422417 }
423418 }
0 commit comments