cytoscape-context-menus
Advanced tools
Comparing version 1.0.0 to 1.0.2
@@ -109,3 +109,9 @@ ;(function($$, $){ 'use strict'; | ||
function bindOnClickFunction($component, onClickFcn) { | ||
$component.on('click', onClickFcn); | ||
var callOnClickFcn; | ||
$component.on('click', callOnClickFcn = function() { | ||
onClickFcn(cy.scratch('currentCyEvent')); | ||
}); | ||
$component.data('call-on-click-function', callOnClickFcn); | ||
} | ||
@@ -123,2 +129,3 @@ | ||
cy.scratch('currentCyEvent', event); | ||
adjustCxtMenu(event); | ||
@@ -130,3 +137,4 @@ displayComponent($component); | ||
if(selector) { | ||
cy.filter(selector).on('cxttap', cxtfcn = function(event) { | ||
cy.on('cxttap', selector, cxtfcn = function(event) { | ||
cy.scratch('currentCyEvent', event); | ||
adjustCxtMenu(event); | ||
@@ -146,2 +154,3 @@ displayComponent($component); | ||
cy.removeScratch('cxtMenuPosition'); | ||
cy.removeScratch('currentCyEvent'); | ||
}); | ||
@@ -235,3 +244,3 @@ } | ||
function destroyCtxMenu() { | ||
function destroyCxtMenu() { | ||
if(!$cxtMenu) { | ||
@@ -261,7 +270,7 @@ return; | ||
var selector = $component.data('selector'); | ||
var onClickFcn = $component.data('on-click-function'); | ||
var callOnClickFcn = $component.data('call-on-click-function'); | ||
var cxtCoreFcn = $component.data('cy-context-menus-cxtcorefcn'); | ||
if(cxtfcn) { | ||
cy.filter(selector).off('cxttap', cxtfcn); | ||
cy.off('cxttap', selector, cxtfcn); | ||
} | ||
@@ -273,4 +282,4 @@ | ||
if(onClickFcn) { | ||
$component.off('click', onClickFcn); | ||
if(callOnClickFcn) { | ||
$component.off('click', callOnClickFcn); | ||
} | ||
@@ -325,3 +334,3 @@ | ||
// Clear old context menu | ||
destroyCtxMenu(); | ||
destroyCxtMenu(); | ||
@@ -415,3 +424,3 @@ $cxtMenu = createAndAppendCxtMenuComponent(); | ||
destroyCtxMenu(); | ||
destroyCxtMenu(); | ||
@@ -418,0 +427,0 @@ return this; // chainability |
{ | ||
"name": "cytoscape-context-menus", | ||
"version": "1.0.0", | ||
"version": "1.0.2", | ||
"description": "A Cytoscape.js extension to provide context menu around elements and core instance.", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-context-menus.js", |
@@ -9,2 +9,3 @@ cytoscape-context-menus | ||
![Image of extension](example.png) | ||
@@ -50,3 +51,5 @@ ## Dependencies | ||
title: 'remove', // Title of menu item | ||
selector: 'node, edge', // Filters the elements to have this menu item on cxttap | ||
// Filters the elements to have this menu item on cxttap | ||
// If the selector is not truthy no elements will have this menu item on cxttap | ||
selector: 'node, edge', | ||
onClickFunction: function () { // The function to be executed on click | ||
@@ -128,1 +131,5 @@ console.log('remove element'); | ||
1. If publishing to bower for the first time, you'll need to run `bower register cytoscape-context-menus https://github.com/iVis-at-Bilkent/cytoscape.js-context-menus.git` | ||
## Team | ||
* [Metin Can Siper](https://github.com/metincansiper), [Ugur Dogrusoz](https://github.com/ugurdogrusoz) of [i-Vis at Bilkent University](http://www.cs.bilkent.edu.tr/~ivis) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41062
11
479
133