-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
1852 persistent click #2824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1852 persistent click #2824
Changes from 36 commits
25c56e4
5602335
f4243b4
b552ccf
b9c893f
c1925ea
0eddcbc
ca80c89
2fb35cf
436a746
64705e1
3900d5c
6a672ed
2bc81a2
f51afcf
a1efe01
722805e
4f0a05d
5125981
a79dea7
4d8b274
231fa6d
6bd46bf
427b4b6
3d21856
b0c32c1
a630ef8
e07210c
e082e58
a97af32
aac89ce
4b41e24
f0822d5
8428bbc
f4384de
bbd63d4
d7087a6
df351c3
0840100
b703a9c
d7e64dd
c4012e1
f9494b5
e7815e9
c88aee0
bd04fd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Copyright 2012-2018, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
|
||
/* | ||
* Computes the set difference of two arrays. | ||
* | ||
* @param {array} a | ||
* @param {array} b | ||
* @returns all elements of a that are not in b. | ||
* If a is not an array, an empty array is returned. | ||
* If b is not an array, a is returned. | ||
*/ | ||
function difference(a, b) { | ||
if(!Array.isArray(a)) { | ||
return []; | ||
} | ||
if(!Array.isArray(b)) { | ||
return a; | ||
} | ||
return a.filter(function(e) { | ||
return b.indexOf(e) < 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like Something like: var small;
var large;
var hash = {};
var out = [];
var i;
if(a.length < b.length) {
small = a;
large = b;
} else {
small = b;
large = a;
}
for(i = 0; i < small.length; i++) {
hash[small[i]] = 1;
}
for(i = 0; i < large.length; i++) {
var l = large[i];
if(hash[l]) {
out.push(l)
}
}
return out; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... it might be nice to look at the lodash's implementation. |
||
}); | ||
} | ||
|
||
module.exports = { | ||
difference: difference | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to make
Plotly.register
set a boolean_module.selected
somewhere here and use that boolean downstream (e.g. inPlots.supplyDefaults
) instead of looking forgetPointsIn
andtoggleSelected
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat! Would
_module.selectable
even be a better name?