cytoscape-context-menus
Advanced tools
Comparing version 2.0.3 to 2.1.0
@@ -42,3 +42,3 @@ ;(function(){ 'use strict'; | ||
}; | ||
var options; | ||
@@ -134,3 +134,5 @@ var $cxtMenu; | ||
adjustCxtMenu(event); | ||
displayComponent($component); | ||
if ($component.data('show')) { | ||
displayComponent($component); | ||
} | ||
}); | ||
@@ -143,3 +145,5 @@ } | ||
adjustCxtMenu(event); | ||
displayComponent($component); | ||
if ($component.data('show')) { | ||
displayComponent($component); | ||
} | ||
}); | ||
@@ -174,3 +178,3 @@ } | ||
var containerPos = $(cy.container()).position(); | ||
var containerPos = $(cy.container()).offset(); | ||
@@ -212,4 +216,4 @@ var left = containerPos.left + event.cyRenderedPosition.x; | ||
$cxtMenu = $('<div id="cy-context-menus-cxt-menu" class=' + classes + '></div>'); | ||
$('body').append($cxtMenu); | ||
return $cxtMenu; | ||
@@ -231,4 +235,4 @@ } | ||
$menuItemComponent.data('selector', item.selector); | ||
$menuItemComponent.data('on-click-function', item.onClickFunction); | ||
$menuItemComponent.data('on-click-function', item.onClickFunction); | ||
$menuItemComponent.data('show', (typeof(item.show) === 'undefined' || item.show)); | ||
return $menuItemComponent; | ||
@@ -376,2 +380,14 @@ } | ||
}, | ||
// Disables the menu item with given ID. | ||
hideMenuItem: function(itemID) { | ||
$('#'+itemID).data('show', false); | ||
hideComponent($('#'+itemID)); | ||
return cy; | ||
}, | ||
// Enables the menu item with given ID. | ||
showMenuItem: function(itemID) { | ||
$('#'+itemID).data('show', true); | ||
displayComponent($('#'+itemID)); | ||
return cy; | ||
}, | ||
// Destroys the extension instance | ||
@@ -378,0 +394,0 @@ destroy: function() { |
{ | ||
"name": "cytoscape-context-menus", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"description": "A Cytoscape.js extension to provide context menu around elements and core instance.", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-context-menus.js", |
@@ -7,3 +7,3 @@ cytoscape-context-menus | ||
A Cytoscape.js extension to provide context menu around elements and core instance. | ||
A Cytoscape.js extension to provide context menu around elements and core instance distributed under [The MIT License](https://opensource.org/licenses/MIT). | ||
@@ -60,2 +60,3 @@ ![Image of extension](example.png) | ||
disabled: false, // Whether the item will be created as disabled | ||
show: false, // Whether the item will be shown or not | ||
hasTrailingDivider: true, // Whether the item will have a trailing divider | ||
@@ -121,2 +122,6 @@ coreAsWell: false // Whether core instance have this item on cxttap | ||
instance.showMenuItem(itemID); // Shows the menu item with given ID. | ||
instance.hideMenuItem(itemID); // Hides the menu item with given ID. | ||
instance.destroy(); // Destroys the extension instance | ||
@@ -123,0 +128,0 @@ ``` |
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
53770
12
506
144