Expand current selection to include neighbors by pressing CTRL+SHIFT+UP
This commit is contained in:
parent
1124d76475
commit
08883e445f
2 changed files with 20 additions and 0 deletions
|
@ -20,6 +20,21 @@ const Control = {
|
|||
node.setData('dim', 30, 'current')
|
||||
Selected.Nodes.push(node)
|
||||
},
|
||||
selectNeighbors: function() {
|
||||
if(Selected.Nodes.length > 0){
|
||||
//For each selected node, select all connected node and the synapses too
|
||||
Selected.Nodes.forEach((item) => {
|
||||
if(Visualize.mGraph.graph.getNode(item.id).adjacencies){
|
||||
for(var adjID in Visualize.mGraph.graph.getNode(item.id).adjacencies){
|
||||
Control.selectNode(Visualize.mGraph.graph.getNode(adjID))
|
||||
Control.selectEdge(Visualize.mGraph.graph.getNode(item.id).adjacencies[adjID])
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Visualize.mGraph.plot()
|
||||
}
|
||||
},
|
||||
deselectAllNodes: function() {
|
||||
var l = Selected.Nodes.length
|
||||
for (var i = l - 1; i >= 0; i -= 1) {
|
||||
|
|
|
@ -31,6 +31,11 @@ const Listeners = {
|
|||
case 27: // if esc key is pressed
|
||||
JIT.escKeyHandler()
|
||||
break
|
||||
case 38: // if UP key is pressed
|
||||
if(e.ctrlKey && e.shiftKey){
|
||||
Control.selectNeighbors()
|
||||
}
|
||||
break
|
||||
case 46: // if DEL is pressed
|
||||
if(e.target.tagName !== "INPUT" && e.target.tagName !== "TEXTAREA" && (Selected.Nodes.length + Selected.Edges.length) > 0){
|
||||
e.preventDefault()
|
||||
|
|
Loading…
Add table
Reference in a new issue