Skip to content

Commit

Permalink
support selecting scatter text
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcjohnson committed Jan 5, 2016
1 parent 556cb83 commit 7b07a25
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/traces/scatter/select.js
Expand Up @@ -9,7 +9,7 @@

'use strict';

var hasMarkers = require('./subtypes').hasMarkers;
var subtypes = require('./subtypes');

var DESELECTDIM = 0.2;

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

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

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

Expand Down Expand Up @@ -58,6 +59,10 @@ module.exports = function selectPoints(searchInfo, polygon) {
.style('opacity', function(d) {
return ((d.mo+1 || opacity+1) - 1) * (d.dim ? DESELECTDIM : 1);
});
cd[0].node3.selectAll('text')
.style('opacity', function(d) {
return d.dim ? DESELECTDIM : 1;
});

return selection;
};

0 comments on commit 7b07a25

Please sign in to comment.