Skip to content

Commit d765bd2

Browse files
committed
Properly retain original opacity of 0 (0 is falsy in JavaScript), closes #1406
1 parent e266a3c commit d765bd2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

inst/htmlwidgets/plotly.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ function TraceManager(graphDiv, highlight) {
522522
// avoid doing this over and over
523523
this.origOpacity = [];
524524
for (var i = 0; i < this.origData.length; i++) {
525-
this.origOpacity[i] = this.origData[i].opacity || 1;
525+
this.origOpacity[i] = this.origData[i].opacity === 0 ? 0 : (this.origData[i].opacity || 1);
526526
}
527527

528528
// key: group name, value: null or array of keys representing the
@@ -603,7 +603,7 @@ TraceManager.prototype.updateSelection = function(group, keys) {
603603

604604
if (keys === null) {
605605

606-
Plotly.restyle(this.gd, {"opacity": this.origOpacity});
606+
Plotly.restyle(this.gd, {"opacity": this.acity});
607607

608608
} else if (keys.length >= 1) {
609609

@@ -741,7 +741,7 @@ TraceManager.prototype.updateSelection = function(group, keys) {
741741
n = this.origData.length;
742742

743743
for (var i = 0; i < n; i++) {
744-
var opacity = this.origOpacity[i] || 1;
744+
var opacity = this.acity[i] || 1;
745745
// have we already dimmed this trace? Or is this even worth doing?
746746
if (opacity !== this.gd._fullData[i].opacity || this.highlight.opacityDim === 1) {
747747
continue;

0 commit comments

Comments
 (0)