@@ -522,7 +522,9 @@ function plot(gd, subplot, cdata) {
522
522
scene . selectBatch = null ;
523
523
scene . unselectBatch = null ;
524
524
var dragmode = fullLayout . dragmode ;
525
- var selectMode = dragmode === 'lasso' || dragmode === 'select' ;
525
+ // TODO get that from layout as soon as clickmode attribute has been added
526
+ var clickmode = 'select' ;
527
+ var selectMode = ( dragmode === 'lasso' || dragmode === 'select' || clickmode === 'select' ) ;
526
528
527
529
for ( i = 0 ; i < cdata . length ; i ++ ) {
528
530
var cd0 = cdata [ i ] [ 0 ] ;
@@ -571,31 +573,32 @@ function plot(gd, subplot, cdata) {
571
573
}
572
574
}
573
575
576
+ if ( selectMode ) {
577
+ // create select2d
578
+ if ( ! scene . select2d ) {
579
+ // create scatter instance by cloning scatter2d
580
+ scene . select2d = createScatter ( fullLayout . _glcanvas . data ( ) [ 1 ] . regl ) ;
581
+ }
574
582
575
- // create select2d
576
- if ( ! scene . select2d ) {
577
- // create scatter instance by cloning scatter2d
578
- scene . select2d = createScatter ( fullLayout . _glcanvas . data ( ) [ 1 ] . regl ) ;
579
- }
580
-
581
- if ( scene . scatter2d && scene . selectBatch && scene . selectBatch . length ) {
582
- // update only traces with selection
583
- scene . scatter2d . update ( scene . markerUnselectedOptions . map ( function ( opts , i ) {
584
- return scene . selectBatch [ i ] ? opts : null ;
585
- } ) ) ;
586
- }
583
+ if ( scene . scatter2d && scene . selectBatch && scene . selectBatch . length ) {
584
+ // update only traces with selection
585
+ scene . scatter2d . update ( scene . markerUnselectedOptions . map ( function ( opts , i ) {
586
+ return scene . selectBatch [ i ] ? opts : null ;
587
+ } ) ) ;
588
+ }
587
589
588
- if ( scene . select2d ) {
589
- scene . select2d . update ( scene . markerOptions ) ;
590
- scene . select2d . update ( scene . markerSelectedOptions ) ;
591
- }
590
+ if ( scene . select2d ) {
591
+ scene . select2d . update ( scene . markerOptions ) ;
592
+ scene . select2d . update ( scene . markerSelectedOptions ) ;
593
+ }
592
594
593
- if ( scene . glText ) {
594
- cdata . forEach ( function ( cdscatter ) {
595
- if ( cdscatter && cdscatter [ 0 ] && cdscatter [ 0 ] . trace ) {
596
- styleTextSelection ( cdscatter ) ;
597
- }
598
- } ) ;
595
+ if ( scene . glText ) {
596
+ cdata . forEach ( function ( cdscatter ) {
597
+ if ( cdscatter && cdscatter [ 0 ] && cdscatter [ 0 ] . trace ) {
598
+ styleTextSelection ( cdscatter ) ;
599
+ }
600
+ } ) ;
601
+ }
599
602
}
600
603
601
604
// provide viewport and range
0 commit comments