Skip to content

Commit 8e181cc

Browse files
committed
rename vars to point to data updates
1 parent 3511eb4 commit 8e181cc

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/components/legend/handle_click.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,21 @@ module.exports = function handleClick(g, gd, numClicks) {
4343
var legendgroup = fullTrace.legendgroup;
4444

4545
var i, j, kcont, key, keys, val;
46-
var attrUpdate = {};
47-
var attrIndices = [];
46+
var dataUpdate = {};
47+
var dataIndices = [];
4848
var carrs = [];
4949
var carrIdx = [];
5050

5151
function insertUpdate(traceIndex, key, value) {
52-
var attrIndex = attrIndices.indexOf(traceIndex);
53-
var valueArray = attrUpdate[key];
52+
var attrIndex = dataIndices.indexOf(traceIndex);
53+
var valueArray = dataUpdate[key];
5454
if(!valueArray) {
55-
valueArray = attrUpdate[key] = [];
55+
valueArray = dataUpdate[key] = [];
5656
}
5757

58-
if(attrIndices.indexOf(traceIndex) === -1) {
59-
attrIndices.push(traceIndex);
60-
attrIndex = attrIndices.length - 1;
58+
if(dataIndices.indexOf(traceIndex) === -1) {
59+
dataIndices.push(traceIndex);
60+
attrIndex = dataIndices.length - 1;
6161
}
6262

6363
valueArray[attrIndex] = value;
@@ -244,7 +244,7 @@ module.exports = function handleClick(g, gd, numClicks) {
244244
var updateKeys = Object.keys(update);
245245
for(j = 0; j < updateKeys.length; j++) {
246246
key = updateKeys[j];
247-
val = attrUpdate[key] = attrUpdate[key] || [];
247+
val = dataUpdate[key] = dataUpdate[key] || [];
248248
val[carrIdx[i]] = update[key];
249249
}
250250
}
@@ -253,17 +253,17 @@ module.exports = function handleClick(g, gd, numClicks) {
253253
// values should be explicitly undefined for them to get properly culled
254254
// as updates and not accidentally reset to the default value. This fills
255255
// out sparse arrays with the required number of undefined values:
256-
keys = Object.keys(attrUpdate);
256+
keys = Object.keys(dataUpdate);
257257
for(i = 0; i < keys.length; i++) {
258258
key = keys[i];
259-
for(j = 0; j < attrIndices.length; j++) {
259+
for(j = 0; j < dataIndices.length; j++) {
260260
// Use hasOwnProperty to protect against falsy values:
261-
if(!attrUpdate[key].hasOwnProperty(j)) {
262-
attrUpdate[key][j] = undefined;
261+
if(!dataUpdate[key].hasOwnProperty(j)) {
262+
dataUpdate[key][j] = undefined;
263263
}
264264
}
265265
}
266266

267-
Registry.call('_guiRestyle', gd, attrUpdate, attrIndices);
267+
Registry.call('_guiRestyle', gd, dataUpdate, dataIndices);
268268
}
269269
};

0 commit comments

Comments
 (0)