Skip to content

Commit bde19ee

Browse files
committed
replace 'focus' -> 'toggleothers'
1 parent 8190738 commit bde19ee

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Diff for: src/components/legend/attributes.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -92,27 +92,27 @@ module.exports = {
9292

9393
itemclick: {
9494
valType: 'enumerated',
95-
values: ['toggle', 'focus', false],
95+
values: ['toggle', 'toggleothers', false],
9696
dflt: 'toggle',
9797
role: 'info',
9898
editType: 'legend',
9999
description: [
100100
'Determines the behavior on legend item click.',
101101
'*toggle* toggles the visibility of the item clicked on the graph.',
102-
'*focus* makes the clicked item the sole visible item on the graph.',
102+
'*toggleothers* makes the clicked item the sole visible item on the graph.',
103103
'*false* disable legend item click interactions.'
104104
].join(' ')
105105
},
106106
itemdoubleclick: {
107107
valType: 'enumerated',
108-
values: ['toggle', 'focus', false],
109-
dflt: 'focus',
108+
values: ['toggle', 'toggleothers', false],
109+
dflt: 'toggleothers',
110110
role: 'info',
111111
editType: 'legend',
112112
description: [
113113
'Determines the behavior on legend item double-click.',
114114
'*toggle* toggles the visibility of the item clicked on the graph.',
115-
'*focus* makes the clicked item the sole visible item on the graph.',
115+
'*toggleothers* makes the clicked item the sole visible item on the graph.',
116116
'*false* disable legend item double-click interactions.'
117117
].join(' ')
118118
},

Diff for: src/components/legend/handle_click.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = function handleClick(g, gd, numClicks) {
2121
var itemClick = fullLayout.legend.itemclick;
2222
var itemDoubleClick = fullLayout.legend.itemdoubleclick;
2323

24-
if(numClicks === 1 && itemClick === 'toggle' && itemDoubleClick === 'focus' &&
24+
if(numClicks === 1 && itemClick === 'toggle' && itemDoubleClick === 'toggleothers' &&
2525
SHOWISOLATETIP && gd.data && gd._context.showTips
2626
) {
2727
Lib.notifier(Lib._(gd, 'Double-click on legend to isolate one trace'), 'long');
@@ -111,7 +111,7 @@ module.exports = function handleClick(g, gd, numClicks) {
111111
if(mode === 'toggle') {
112112
if(thisLabelIndex === -1) hiddenSlices.push(thisLabel);
113113
else hiddenSlices.splice(thisLabelIndex, 1);
114-
} else if(mode === 'focus') {
114+
} else if(mode === 'toggleothers') {
115115
hiddenSlices = [];
116116
gd.calcdata[0].forEach(function(d) {
117117
if(thisLabel !== d.label) {
@@ -162,7 +162,7 @@ module.exports = function handleClick(g, gd, numClicks) {
162162
} else {
163163
setVisibility(fullTrace, nextVisibility);
164164
}
165-
} else if(mode === 'focus') {
165+
} else if(mode === 'toggleothers') {
166166
// Compute the clicked index. expandedIndex does what we want for expanded traces
167167
// but also culls hidden traces. That means we have some work to do.
168168
var isClicked, isInGroup, otherState;

Diff for: test/jasmine/tests/legend_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ describe('legend interaction', function() {
16861686
.then(click(0, 2)).then(_assert([true, true, true]))
16871687
.then(function() {
16881688
return Plotly.relayout(gd, {
1689-
'legend.itemclick': 'focus',
1689+
'legend.itemclick': 'toggleothers',
16901690
'legend.itemdoubleclick': 'toggle'
16911691
});
16921692
})

0 commit comments

Comments
 (0)