cytoscape-context-menus
Advanced tools
Comparing version 2.1.1 to 3.0.0
@@ -16,3 +16,4 @@ ;(function(){ 'use strict'; | ||
id: 'remove', | ||
title: 'remove', | ||
content: 'remove', | ||
tooltipText: 'remove', | ||
selector: 'node, edge', | ||
@@ -26,3 +27,4 @@ onClickFunction: function () { | ||
id: 'hide', | ||
title: 'hide', | ||
content: 'hide', | ||
tooltipText: 'remove', | ||
selector: 'node, edge', | ||
@@ -148,3 +150,4 @@ onClickFunction: function () { | ||
cy.on('cxttap', cxtCoreFcn = function(event) { | ||
if( event.cyTarget != cy ) { | ||
var target = event.target || event.cyTarget; | ||
if( target != cy ) { | ||
return; | ||
@@ -184,12 +187,14 @@ } | ||
var currentCxtMenuPosition = cy.scratch('cxtMenuPosition'); | ||
var cyPos = event.position || event.cyPosition; | ||
if( currentCxtMenuPosition != event.cyPosition ) { | ||
if( currentCxtMenuPosition != cyPos ) { | ||
hideMenuItemComponents(); | ||
anyVisibleChild = false; // we hide all children there is no visible child remaining | ||
cy.scratch('cxtMenuPosition', event.cyPosition); | ||
cy.scratch('cxtMenuPosition', cyPos); | ||
var containerPos = $(cy.container()).offset(); | ||
var renderedPos = event.renderedPosition || event.cyRenderedPosition; | ||
var left = containerPos.left + event.cyRenderedPosition.x; | ||
var top = containerPos.top + event.cyRenderedPosition.y; | ||
var left = containerPos.left + renderedPos.x; | ||
var top = containerPos.top + renderedPos.y; | ||
@@ -235,4 +240,8 @@ $cxtMenu.css('left', left); | ||
var classStr = getMenuItemClassStr(options.menuItemClasses, item.hasTrailingDivider); | ||
var itemStr = '<button id="' + item.id + '" title="' + item.title + '" class="' + classStr + '"'; | ||
var itemStr = '<button id="' + item.id + '" content="' + item.content + '" class="' + classStr + '"'; | ||
if(item.tooltipText) { | ||
itemStr += ' title="' + item.tooltipText + '"'; | ||
} | ||
if(item.disabled) { | ||
@@ -239,0 +248,0 @@ itemStr += ' disabled'; |
{ | ||
"name": "cytoscape-context-menus", | ||
"version": "2.1.1", | ||
"version": "3.0.0", | ||
"description": "A Cytoscape.js extension to provide context menu around elements and core instance.", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-context-menus.js", |
@@ -51,3 +51,4 @@ cytoscape-context-menus | ||
id: 'remove', // ID of menu item | ||
title: 'remove', // Title of menu item | ||
content: 'remove', // Display content of menu item | ||
tooltipText: 'remove', // Tooltip text for menu item | ||
// Filters the elements to have this menu item on cxttap | ||
@@ -66,3 +67,4 @@ // If the selector is not truthy no elements will have this menu item on cxttap | ||
id: 'hide', | ||
title: 'hide', | ||
content: 'hide', | ||
tooltipText: 'hide', | ||
selector: 'node, edge', | ||
@@ -76,3 +78,4 @@ onClickFunction: function () { | ||
id: 'add-node', | ||
title: 'add node', | ||
content: 'add node', | ||
tooltipText: 'add node', | ||
selector: 'node', | ||
@@ -79,0 +82,0 @@ coreAsWell: true, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
56720
524
147