Skip to content

Commit

Permalink
replace 'focus' -> 'toggleothers'
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed May 17, 2019
1 parent 8190738 commit bde19ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/components/legend/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,27 +92,27 @@ module.exports = {

itemclick: {
valType: 'enumerated',
values: ['toggle', 'focus', false],
values: ['toggle', 'toggleothers', false],
dflt: 'toggle',
role: 'info',
editType: 'legend',
description: [
'Determines the behavior on legend item click.',
'*toggle* toggles the visibility of the item clicked on the graph.',
'*focus* makes the clicked item the sole visible item on the graph.',
'*toggleothers* makes the clicked item the sole visible item on the graph.',
'*false* disable legend item click interactions.'
].join(' ')
},
itemdoubleclick: {
valType: 'enumerated',
values: ['toggle', 'focus', false],
dflt: 'focus',
values: ['toggle', 'toggleothers', false],
dflt: 'toggleothers',
role: 'info',
editType: 'legend',
description: [
'Determines the behavior on legend item double-click.',
'*toggle* toggles the visibility of the item clicked on the graph.',
'*focus* makes the clicked item the sole visible item on the graph.',
'*toggleothers* makes the clicked item the sole visible item on the graph.',
'*false* disable legend item double-click interactions.'
].join(' ')
},
Expand Down
6 changes: 3 additions & 3 deletions src/components/legend/handle_click.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = function handleClick(g, gd, numClicks) {
var itemClick = fullLayout.legend.itemclick;
var itemDoubleClick = fullLayout.legend.itemdoubleclick;

if(numClicks === 1 && itemClick === 'toggle' && itemDoubleClick === 'focus' &&
if(numClicks === 1 && itemClick === 'toggle' && itemDoubleClick === 'toggleothers' &&
SHOWISOLATETIP && gd.data && gd._context.showTips
) {
Lib.notifier(Lib._(gd, 'Double-click on legend to isolate one trace'), 'long');
Expand Down Expand Up @@ -111,7 +111,7 @@ module.exports = function handleClick(g, gd, numClicks) {
if(mode === 'toggle') {
if(thisLabelIndex === -1) hiddenSlices.push(thisLabel);
else hiddenSlices.splice(thisLabelIndex, 1);
} else if(mode === 'focus') {
} else if(mode === 'toggleothers') {
hiddenSlices = [];
gd.calcdata[0].forEach(function(d) {
if(thisLabel !== d.label) {
Expand Down Expand Up @@ -162,7 +162,7 @@ module.exports = function handleClick(g, gd, numClicks) {
} else {
setVisibility(fullTrace, nextVisibility);
}
} else if(mode === 'focus') {
} else if(mode === 'toggleothers') {
// Compute the clicked index. expandedIndex does what we want for expanded traces
// but also culls hidden traces. That means we have some work to do.
var isClicked, isInGroup, otherState;
Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/tests/legend_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1686,7 +1686,7 @@ describe('legend interaction', function() {
.then(click(0, 2)).then(_assert([true, true, true]))
.then(function() {
return Plotly.relayout(gd, {
'legend.itemclick': 'focus',
'legend.itemclick': 'toggleothers',
'legend.itemdoubleclick': 'toggle'
});
})
Expand Down

0 comments on commit bde19ee

Please sign in to comment.