@@ -615,6 +615,14 @@ function plot(gd, subplot, cdata) {
615
615
scene . select2d . update ( scene . markerOptions ) ;
616
616
scene . select2d . update ( scene . markerSelectedOptions ) ;
617
617
}
618
+
619
+ if ( scene . glText ) {
620
+ cdata . forEach ( function ( cdscatter ) {
621
+ if ( cdscatter && cdscatter [ 0 ] && cdscatter [ 0 ] . trace ) {
622
+ styleTextSelection ( cdscatter ) ;
623
+ }
624
+ } ) ;
625
+ }
618
626
}
619
627
620
628
// upload viewport/range data to GPU
@@ -882,38 +890,17 @@ function selectPoints(searchInfo, polygon) {
882
890
}
883
891
}
884
892
893
+ scene . selectBatch [ stash . index ] = els ;
894
+ scene . unselectBatch [ stash . index ] = unels ;
895
+
885
896
// update text options
886
897
if ( hasText ) {
887
- var baseOpts = scene . textOptions [ stash . index ] ;
888
- var selOpts = scene . textSelectedOptions [ stash . index ] || { } ;
889
- var unselOpts = scene . textUnselectedOptions [ stash . index ] || { } ;
890
- var opts = Lib . extendFlat ( { } , baseOpts ) ;
891
-
892
- if ( els && unels ) {
893
- var stc = selOpts . color ;
894
- var utc = unselOpts . color ;
895
- var base = baseOpts . color ;
896
- opts . color = new Array ( stash . count ) ;
897
-
898
- for ( i = 0 ; i < els . length ; i ++ ) {
899
- opts . color [ els [ i ] ] = stc || base ;
900
- }
901
- for ( i = 0 ; i < unels . length ; i ++ ) {
902
- opts . color [ unels [ i ] ] = utc ? utc :
903
- stc ? base : Color . addOpacity ( base , DESELECTDIM ) ;
904
- }
905
- }
906
-
907
- scene . glText [ stash . index ] . update ( opts ) ;
898
+ styleTextSelection ( cd ) ;
908
899
}
909
900
910
- scene . selectBatch [ stash . index ] = els ;
911
- scene . unselectBatch [ stash . index ] = unels ;
912
-
913
901
return selection ;
914
902
}
915
903
916
-
917
904
function style ( gd , cds ) {
918
905
if ( ! cds ) return ;
919
906
@@ -929,6 +916,36 @@ function style(gd, cds) {
929
916
scene . draw ( ) ;
930
917
}
931
918
919
+ function styleTextSelection ( cd ) {
920
+ var cd0 = cd [ 0 ] ;
921
+ var stash = cd0 . t ;
922
+ var scene = stash . _scene ;
923
+ var index = stash . index ;
924
+ var els = scene . selectBatch [ index ] ;
925
+ var unels = scene . unselectBatch [ index ] ;
926
+ var baseOpts = scene . textOptions [ index ] ;
927
+ var selOpts = scene . textSelectedOptions [ index ] || { } ;
928
+ var unselOpts = scene . textUnselectedOptions [ index ] || { } ;
929
+ var opts = Lib . extendFlat ( { } , baseOpts ) ;
930
+ var i ;
931
+
932
+ if ( els && unels ) {
933
+ var stc = selOpts . color ;
934
+ var utc = unselOpts . color ;
935
+ var base = baseOpts . color ;
936
+ opts . color = new Array ( stash . count ) ;
937
+
938
+ for ( i = 0 ; i < els . length ; i ++ ) {
939
+ opts . color [ els [ i ] ] = stc || base ;
940
+ }
941
+ for ( i = 0 ; i < unels . length ; i ++ ) {
942
+ opts . color [ unels [ i ] ] = utc ? utc :
943
+ stc ? base : Color . addOpacity ( base , DESELECTDIM ) ;
944
+ }
945
+ }
946
+
947
+ scene . glText [ index ] . update ( opts ) ;
948
+ }
932
949
933
950
module . exports = {
934
951
moduleType : 'trace' ,
0 commit comments