diff --git a/README.md b/README.md index 1b2398a..4cbe162 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,13 @@ A Cytoscape.js extension to provide context menu around elements and core instan ![Image of extension](example.png) +Please cite the following paper when using this extension: + +U. Dogrusoz , A. Karacelik, I. Safarli, H. Balci, L. Dervishi, and M.C. Siper, "[Efficient methods and readily customizable libraries for managing complexity of large networks](https://doi.org/10.1371/journal.pone.0197238)", PLoS ONE, 13(5): e0197238, 2018. + ## Demo -Click [here](https://ivis-at-bilkent.github.io/cytoscape.js-context-menus/demo.html) (simple) or [here](https://ivis-at-bilkent.github.io/cytoscape.js-context-menus/demo-customized.html) (customized) or [here](https://ivis-at-bilkent.github.io/cytoscape.js-context-menus/demo-show-hide-menuitem.html) (with different menu items) for demos +Click [here](https://raw.githack.com/iVis-at-Bilkent/cytoscape.js-context-menus/unstable/demo.html) (simple) or [here](https://raw.githack.com/iVis-at-Bilkent/cytoscape.js-context-menus/unstable/demo-customized.html) (customized) or [here](https://raw.githack.com/iVis-at-Bilkent/cytoscape.js-context-menus/unstable/demo-show-hide-menuitem.html) (with different menu items) for demos ## Dependencies @@ -62,6 +66,9 @@ Plain HTML/JS has the extension registered for you automatically, because no `re ## Default Options ```js var options = { + // Customize event to bring up the context menu + // Possible options https://js.cytoscape.org/#events/user-input-device-events + evtType: 'cxttap', // List of initial menu items menuItems: [/* { diff --git a/cytoscape-context-menus.js b/cytoscape-context-menus.js index 15b477e..b160362 100644 --- a/cytoscape-context-menus.js +++ b/cytoscape-context-menus.js @@ -7,6 +7,9 @@ if( !cytoscape ){ return; } // can't register if cytoscape unspecified var defaults = { + // Customize event to bring up the context menu + // Possible options https://js.cytoscape.org/#events/user-input-device-events + evtType: 'cxttap', // List of initial menu items menuItems: [ /* @@ -158,9 +161,9 @@ var cxtfcn; var cxtCoreFcn; - if(coreAsWell) { - cy.on('cxttap', cxtCoreFcn = function(event) { + + cy.on(options.evtType, cxtCoreFcn = function(event) { var target = event.target || event.cyTarget; if( target != cy ) { return; @@ -171,7 +174,7 @@ } if(selector) { - cy.on('cxttap', selector, cxtfcn = function(event) { + cy.on(options.evtType, selector, cxtfcn = function(event) { _cxtfcn(event); }); } @@ -361,13 +364,13 @@ var selector = $component.data('selector'); var callOnClickFcn = $component.data('call-on-click-function'); var cxtCoreFcn = $component.data('cy-context-menus-cxtcorefcn'); - + if(cxtfcn) { - cy.off('cxttap', selector, cxtfcn); + cy.off(options.evtType, selector, cxtfcn); } if(cxtCoreFcn) { - cy.off('cxttap', cxtCoreFcn); + cy.off(options.evtType, cxtCoreFcn); } if(callOnClickFcn) {