diff --git a/src/components/legend/attributes.js b/src/components/legend/attributes.js index 371cad9c158..2eee7aa05cb 100644 --- a/src/components/legend/attributes.js +++ b/src/components/legend/attributes.js @@ -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(' ') }, diff --git a/src/components/legend/handle_click.js b/src/components/legend/handle_click.js index 780cc1d8e2f..6bc98641108 100644 --- a/src/components/legend/handle_click.js +++ b/src/components/legend/handle_click.js @@ -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'); @@ -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) { @@ -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; diff --git a/test/jasmine/tests/legend_test.js b/test/jasmine/tests/legend_test.js index 6036dafdc58..f4b5cf5d7b7 100644 --- a/test/jasmine/tests/legend_test.js +++ b/test/jasmine/tests/legend_test.js @@ -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' }); })