Skip to content
Snippets Groups Projects
Commit 423a6ac3 authored by Amira Abdel-Rahman's avatar Amira Abdel-Rahman
Browse files

Add and remove nodes

parent 22523c9e
Branches
No related tags found
No related merge requests found
Pipeline #4528 passed
var font= "Times New Roman", Times, serif;
var cy = cytoscape({ var cy = cytoscape({
container: document.getElementById('cy'), container: document.getElementById('cy'),
style: cytoscape.stylesheet() style: cytoscape.stylesheet()
......
...@@ -172,6 +172,34 @@ document.addEventListener('DOMContentLoaded', function(){ ...@@ -172,6 +172,34 @@ document.addEventListener('DOMContentLoaded', function(){
console.log(this._private.data); console.log(this._private.data);
}); });
//TODO: FIX
cy.on('tap', 'edge', function(){
var nodes = this;
selectedjson=this._private.data;
console.log(this._private.data);
});
cy.on('tap', function( evt ){
var tgt = evt.target || evt.cyTarget; // 3.x || 2.x
if( tgt === cy ){
cy.add({
classes: 'automove-viewport',
data: { id: 'new' + Math.round( Math.random() * 100 ) },
position: {
x: evt.position.x,
y: evt.position.y
}
});
}
});
cy.on('cxttap', 'node', function( evt ){
var tgt = evt.target || evt.cyTarget; // 3.x || 2.x
tgt.remove();
});
var api = cy.expandCollapse('get'); var api = cy.expandCollapse('get');
var elements = null; var elements = null;
...@@ -208,3 +236,6 @@ document.addEventListener('DOMContentLoaded', function(){ ...@@ -208,3 +236,6 @@ document.addEventListener('DOMContentLoaded', function(){
}); });
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment