-
Notifications
You must be signed in to change notification settings - Fork 1
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
[RFC] Add a search box #2
base: master
Are you sure you want to change the base?
Conversation
@eric-wieser Do you have any more principled way of editing the code for this graph, i.e. do you generate it from typescript like it seems the Sigma demos do? |
No, that's #1 |
@@ -395,6 +404,60 @@ | |||
}, | |||
}); | |||
|
|||
// Feed the datalist autocomplete values: | |||
|
|||
searchSuggestions.innerHTML = graph.nodes().map(node=>"<option value=\"".concat(graph.getNodeAttribute(node, "label"), "\"></option>")).join("\n"); |
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.
I think we should sort these alphabetically
// autocomplete: | ||
|
||
if (suggestions.length === 1 && suggestions[0].label === query) { | ||
state.selectedNode = suggestions[0].id; |
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.
Can you merge state.selectedNode
and state.defaultNode
? I think they achieve the same goal here.
// we consider the user has selected a node through the datalist | ||
// autocomplete: | ||
|
||
if (suggestions.length === 1 && suggestions[0].label === query) { |
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.
This logic doesn't work for data.int.basic
, which matches multiple nodes
I wanted to be able to find stuff in the graph so I hacked together a search box from some sigma.js examples, what do you think?
It needs some tidying up but if you think its a nice addition we can definitely discuss what the best way to include it is.
See https://alexjbest.github.io/mathlib-import-graph/