Skip to content

Commit

Permalink
Show hidden neighbors #76
Browse files Browse the repository at this point in the history
  • Loading branch information
metincansiper committed Oct 13, 2016
1 parent d311aa6 commit 34f4070
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
1 change: 1 addition & 0 deletions sample-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
<ul class="dropdown-menu">
<li><a href="#" id="hide-selected">Hide Selected</a></li>
<li><a href="#" id="show-selected">Show Selected</a></li>
<li><a href="#" id="show-hidden-neighbors-of-selected">Show Hidden Neighbors of Selected</a></li>
<li><a href="#" id="show-all">Show All</a></li>
</ul>
</li>
Expand Down
13 changes: 13 additions & 0 deletions sample-app/sampleapp-components/js/general-sample-app-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,4 +276,17 @@ var nodeResizeEndFunction = function (nodes) {

nodes.removeClass('noderesized');
nodes.addClass('noderesized');
};

var showHiddenNeighbors = function (eles) {
var hiddenNeighbours = sbgnFiltering.getProcessesOfGivenEles(eles).filter(':hidden');
if (hiddenNeighbours.length === 0) {
return;
}

var param = {
eles: hiddenNeighbours
};

cy.undoRedo().do("showAndPerformIncrementalLayout", param);
};
13 changes: 1 addition & 12 deletions sample-app/sampleapp-components/js/sample-app-cytoscape-sbgn.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,19 +450,8 @@ var SBGNContainer = Backbone.View.extend({
title: 'Show Hidden Neighbors',
selector: 'node',
onClickFunction: function (event) {
// TODO move this content to another function (We should find a suitable code base for it)
// and call that function here
var cyTarget = event.cyTarget;
var hiddenNeighbours = sbgnFiltering.getProcessesOfGivenEles(cyTarget).filter(':hidden');
if(hiddenNeighbours.length === 0) {
return;
}

var param = {
eles: hiddenNeighbours
};

cy.undoRedo().do("showAndPerformIncrementalLayout", param);
showHiddenNeighbors(cyTarget);
}
}
]);
Expand Down
11 changes: 11 additions & 0 deletions sample-app/sampleapp-components/js/sample-app-menu-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,17 @@ $(document).ready(function () {

// cy.undoRedo().do("showAll", {});
});

$("#show-hidden-neighbors-of-selected").click(function (e) {
var selected = cy.nodes(':selected');

if (selected.length == 0) {
return;
}

showHiddenNeighbors(selected);
});


$("#delete-selected-smart").click(function (e) {
if(cy.$(":selected").length == 0){
Expand Down

0 comments on commit 34f4070

Please sign in to comment.