Skip to content

Commit 7b07a25

Browse files
committed
support selecting scatter text
1 parent 556cb83 commit 7b07a25

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/traces/scatter/select.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
'use strict';
1111

12-
var hasMarkers = require('./subtypes').hasMarkers;
12+
var subtypes = require('./subtypes');
1313

1414
var DESELECTDIM = 0.2;
1515

@@ -26,7 +26,8 @@ module.exports = function selectPoints(searchInfo, polygon) {
2626
x,
2727
y;
2828

29-
if(!hasMarkers(trace)) return; // TODO: include text and/or lines?
29+
// TODO: include lines? that would require per-segment line properties
30+
if(!subtypes.hasMarkers(trace) && ! subtypes.hasText(trace)) return;
3031

3132
var opacity = Array.isArray(marker.opacity) ? 1 : marker.opacity;
3233

@@ -58,6 +59,10 @@ module.exports = function selectPoints(searchInfo, polygon) {
5859
.style('opacity', function(d) {
5960
return ((d.mo+1 || opacity+1) - 1) * (d.dim ? DESELECTDIM : 1);
6061
});
62+
cd[0].node3.selectAll('text')
63+
.style('opacity', function(d) {
64+
return d.dim ? DESELECTDIM : 1;
65+
});
6166

6267
return selection;
6368
};

0 commit comments

Comments
 (0)