Skip to content

Commit 9b77f9f

Browse files
monferaetpinard
authored andcommitted
more upstream fix for avoiding invisible traces
1 parent c227992 commit 9b77f9f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/plots/cartesian/select.js

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ var MINSELECT = constants.MINSELECT;
2323

2424
function getAxId(ax) { return ax._id; }
2525

26+
function visible(searchInfo) {
27+
var cd0 = searchInfo.cd[0];
28+
return cd0 && cd0.trace && cd0.trace.visible === true;
29+
}
30+
2631
module.exports = function prepSelect(e, startX, startY, dragOptions, mode) {
2732
var zoomLayer = dragOptions.gd._fullLayout._zoomlayer,
2833
dragBBox = dragOptions.element.getBoundingClientRect(),
@@ -190,6 +195,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) {
190195
selection = [];
191196
for(i = 0; i < searchTraces.length; i++) {
192197
searchInfo = searchTraces[i];
198+
if(!visible(searchInfo)) continue;
193199
var thisSelection = fillSelectionItem(
194200
searchInfo.selectPoints(searchInfo, poly), searchInfo
195201
);
@@ -218,6 +224,7 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) {
218224
outlines.remove();
219225
for(i = 0; i < searchTraces.length; i++) {
220226
searchInfo = searchTraces[i];
227+
if(!visible(searchInfo)) continue;
221228
searchInfo.selectPoints(searchInfo, false);
222229
}
223230

src/traces/choropleth/select.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,9 @@ module.exports = function selectPoints(searchInfo, polygon) {
4646
}
4747
}
4848

49-
if(node3) {
50-
node3.selectAll('path').style('opacity', function(d) {
51-
return d.dim ? DESELECTDIM : 1;
52-
});
53-
}
49+
node3.selectAll('path').style('opacity', function(d) {
50+
return d.dim ? DESELECTDIM : 1;
51+
});
5452

5553
return selection;
5654
};

0 commit comments

Comments
 (0)