Skip to content

Commit

Permalink
quick fix and refactoring for searching
Browse files Browse the repository at this point in the history
  • Loading branch information
ivp08001 committed Jan 6, 2016
1 parent e1318a3 commit 56ab1b3
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions VQI_PathwayEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,31 +318,38 @@ var VQI_PathwayEditor = function (parent) {
dialogNewPathway.dialog("close");
}

function focus(name){
var cy = $('#' + parent + '-cy').cytoscape('get');
cy.elements("node[name = \"" + name + "\"]").select();
cy.$('node').style("opacity", 0.2);
cy.$('edge').style("opacity", 0.2);
cy.$('node:selected').style("opacity", 1.0);
cy.$('edge:selected').style("opacity", 1.0);
}

function unFocus(){
var cy = $('#' + parent + '-cy').cytoscape('get');
cy.$('node').unselect();
cy.$('node').removeStyle("opacity");
cy.$('edge').removeStyle("opacity");
cy.$('node:selected').removeStyle("opacity");
cy.$('edge:selected').removeStyle("opacity");
}

function search(event){
var cy = $('#' + parent + '-cy').cytoscape('get');
var name = document.getElementById(parent + "-search-node-name").value;
unFocus();
if(name != ""){
cy.elements("node[name = \"" + name + "\"]").select();
cy.$('node').style("opacity", 0.2);
cy.$('edge').style("opacity", 0.2);
cy.$('node:selected').style("opacity", 1.0);
cy.$('edge:selected').style("opacity", 1.0);
focus(name);
} else {
cy.$('node').unselect();
cy.$('node').removeStyle("opacity");
cy.$('edge').removeStyle("opacity");
cy.$('node:selected').removeStyle("opacity");
cy.$('edge:selected').removeStyle("opacity");
unFocus();
}
}

function exitSearch(event){
var cy = $('#' + parent + '-cy').cytoscape('get');
cy.$('node').unselect();
cy.$('node').removeStyle("opacity");
cy.$('edge').removeStyle("opacity");
cy.$('node:selected').removeStyle("opacity");
cy.$('edge:selected').removeStyle("opacity");
unFocus();
}

function onChangePathwayFile(event) {
Expand Down

0 comments on commit 56ab1b3

Please sign in to comment.