@@ -30,7 +30,7 @@ var DASHES = require('../../constants/gl2d_dashes');
30
30
31
31
var AXES = [ 'xaxis' , 'yaxis' ] ;
32
32
var DESELECTDIM = 0.2 ;
33
- var transparent = [ 0 , 0 , 0 , 0 ] ;
33
+ var TRANSPARENT = [ 0 , 0 , 0 , 0 ] ;
34
34
35
35
function LineWithMarkers ( scene , uid ) {
36
36
this . scene = scene ;
@@ -259,10 +259,14 @@ function isSymbolOpen(symbol) {
259
259
return symbol . split ( '-open' ) [ 1 ] === '' ;
260
260
}
261
261
262
- function fillColor ( colorIn , colorOut , offsetIn , offsetOut ) {
263
- for ( var j = 0 ; j < 4 ; j ++ ) {
262
+ function fillColor ( colorIn , colorOut , offsetIn , offsetOut , isDimmed ) {
263
+ var dim = isDimmed ? DESELECTDIM : 1 ;
264
+ var j ;
265
+
266
+ for ( j = 0 ; j < 3 ; j ++ ) {
264
267
colorIn [ 4 * offsetIn + j ] = colorOut [ 4 * offsetOut + j ] ;
265
268
}
269
+ colorIn [ 4 * offsetIn + j ] = dim * colorOut [ 4 * offsetOut + j ] ;
266
270
}
267
271
268
272
proto . update = function ( options , cdscatter ) {
@@ -582,7 +586,7 @@ proto.updateFancy = function(options) {
582
586
var colors = convertColorScale ( markerOpts , markerOpacity , traceOpacity , len ) ;
583
587
var borderWidths = convertNumber ( markerOpts . line . width , len ) ;
584
588
var borderColors = convertColorScale ( markerOpts . line , markerOpacity , traceOpacity , len ) ;
585
- var index , size , symbol , symbolSpec , isOpen , _colors , _borderColors , bw , minBorderWidth ;
589
+ var index , size , symbol , symbolSpec , isOpen , isDimmed , _colors , _borderColors , bw , minBorderWidth ;
586
590
587
591
sizes = convertArray ( markerSizeFunc , markerOpts . size , len ) ;
588
592
@@ -592,6 +596,7 @@ proto.updateFancy = function(options) {
592
596
symbol = symbols [ index ] ;
593
597
symbolSpec = MARKER_SYMBOLS [ symbol ] ;
594
598
isOpen = isSymbolOpen ( symbol ) ;
599
+ isDimmed = selIds && ! selIds [ index ] ;
595
600
596
601
if ( symbolSpec . noBorder && ! isOpen ) {
597
602
_colors = borderColors ;
@@ -615,23 +620,12 @@ proto.updateFancy = function(options) {
615
620
this . scatter . options . glyphs [ i ] = symbolSpec . unicode ;
616
621
this . scatter . options . borderWidths [ i ] = 0.5 * ( ( bw > minBorderWidth ) ? bw - minBorderWidth : 0 ) ;
617
622
618
- // FIXME
619
-
620
- for ( j = 0 ; j < 4 ; ++ j ) {
621
- var color = colors [ 4 * index + j ] ;
622
- if ( selIds && ! selIds [ index ] && j === 3 ) {
623
- color *= DESELECTDIM ;
624
- }
625
- this . scatter . options . colors [ 4 * i + j ] = color ;
626
- this . scatter . options . borderColors [ 4 * i + j ] = borderColors [ 4 * index + j ] ;
627
- }
628
-
629
623
if ( isOpen && ! symbolSpec . noBorder && ! symbolSpec . noFill ) {
630
- fillColor ( this . scatter . options . colors , transparent , i , 0 ) ;
624
+ fillColor ( this . scatter . options . colors , TRANSPARENT , i , 0 ) ;
631
625
} else {
632
- fillColor ( this . scatter . options . colors , _colors , i , index ) ;
626
+ fillColor ( this . scatter . options . colors , _colors , i , index , isDimmed ) ;
633
627
}
634
- fillColor ( this . scatter . options . borderColors , _borderColors , i , index ) ;
628
+ fillColor ( this . scatter . options . borderColors , _borderColors , i , index , isDimmed ) ;
635
629
}
636
630
637
631
// prevent scatter from resnapping points
0 commit comments