cytoscape-cxtmenu
Advanced tools
Comparing version 2.9.4 to 2.9.5
@@ -171,53 +171,53 @@ /*! | ||
function createMenuItems() { | ||
removeEles('.cxtmenu-item', parent); | ||
var dtheta = 2 * Math.PI / (commands.length); | ||
var theta1 = Math.PI / 2; | ||
var theta2 = theta1 + dtheta; | ||
function createMenuItems() { | ||
removeEles('.cxtmenu-item', parent); | ||
var dtheta = 2 * Math.PI / (commands.length); | ||
var theta1 = Math.PI / 2; | ||
var theta2 = theta1 + dtheta; | ||
for (var i = 0; i < commands.length; i++) { | ||
var command = commands[i]; | ||
for (var i = 0; i < commands.length; i++) { | ||
var command = commands[i]; | ||
var midtheta = (theta1 + theta2) / 2; | ||
var rx1 = 0.66 * r * Math.cos(midtheta); | ||
var ry1 = 0.66 * r * Math.sin(midtheta); | ||
var midtheta = (theta1 + theta2) / 2; | ||
var rx1 = 0.66 * r * Math.cos(midtheta); | ||
var ry1 = 0.66 * r * Math.sin(midtheta); | ||
var item = createElement({class: 'cxtmenu-item'}); | ||
setStyles(item, { | ||
color: options.itemColor, | ||
cursor: 'default', | ||
display: 'table', | ||
'text-align': 'center', | ||
//background: 'red', | ||
position: 'absolute', | ||
'text-shadow': '-1px -1px ' + options.itemTextShadowColor + ', 1px -1px ' + options.itemTextShadowColor + ', -1px 1px ' + options.itemTextShadowColor + ', 1px 1px ' + options.itemTextShadowColor, | ||
left: '50%', | ||
top: '50%', | ||
'min-height': (r * 0.66) + 'px', | ||
width: (r * 0.66) + 'px', | ||
height: (r * 0.66) + 'px', | ||
marginLeft: (rx1 - r * 0.33) + 'px', | ||
marginTop: (-ry1 - r * 0.33) + 'px' | ||
}); | ||
var item = createElement({class: 'cxtmenu-item'}); | ||
setStyles(item, { | ||
color: options.itemColor, | ||
cursor: 'default', | ||
display: 'table', | ||
'text-align': 'center', | ||
//background: 'red', | ||
position: 'absolute', | ||
'text-shadow': '-1px -1px ' + options.itemTextShadowColor + ', 1px -1px ' + options.itemTextShadowColor + ', -1px 1px ' + options.itemTextShadowColor + ', 1px 1px ' + options.itemTextShadowColor, | ||
left: '50%', | ||
top: '50%', | ||
'min-height': (r * 0.66) + 'px', | ||
width: (r * 0.66) + 'px', | ||
height: (r * 0.66) + 'px', | ||
marginLeft: (rx1 - r * 0.33) + 'px', | ||
marginTop: (-ry1 - r * 0.33) + 'px' | ||
}); | ||
var content = createElement({class: 'cxtmenu-content'}); | ||
content.innerHTML = command.content; | ||
setStyles(content, { | ||
'width': (r * 0.66) + 'px', | ||
'height': (r * 0.66) + 'px', | ||
'vertical-align': 'middle', | ||
'display': 'table-cell' | ||
}); | ||
var content = createElement({class: 'cxtmenu-content'}); | ||
content.innerHTML = command.content; | ||
setStyles(content, { | ||
'width': (r * 0.66) + 'px', | ||
'height': (r * 0.66) + 'px', | ||
'vertical-align': 'middle', | ||
'display': 'table-cell' | ||
}); | ||
if (command.disabled) { | ||
content.classList.add('cxtmenu-disabled'); | ||
} | ||
if (command.disabled) { | ||
content.classList.add('cxtmenu-disabled'); | ||
} | ||
parent.appendChild(item); | ||
item.appendChild(content); | ||
parent.appendChild(item); | ||
item.appendChild(content); | ||
theta1 += dtheta; | ||
theta2 += dtheta; | ||
theta1 += dtheta; | ||
theta2 += dtheta; | ||
} | ||
} | ||
} | ||
@@ -390,4 +390,4 @@ function queueDrawBg( rspotlight ){ | ||
var panEnabled; | ||
var boxEnabled; | ||
var gestureStartEvent; | ||
var boxSelectionEnabled; | ||
@@ -413,3 +413,3 @@ var restoreZoom = function(){ | ||
var restoreBoxSeln = function(){ | ||
if( boxSelectionEnabled ){ | ||
if( boxEnabled ){ | ||
cy.boxSelectionEnabled( true ); | ||
@@ -454,3 +454,3 @@ } | ||
boxSelectionEnabled = cy.boxSelectionEnabled(); | ||
boxEnabled = cy.boxSelectionEnabled(); | ||
cy.boxSelectionEnabled( false ); | ||
@@ -562,26 +562,16 @@ | ||
.on('cxttap tap', options.selector, function(e){ | ||
var ele = this; | ||
.on('cxttapend tapend', function(e){ | ||
parent.style.display = 'none'; | ||
if( activeCommandI !== undefined ){ | ||
var select = commands[ activeCommandI ].select; | ||
if( select ){ | ||
select.apply( ele, [ele, gestureStartEvent] ); | ||
select.apply( target, [target, gestureStartEvent] ); | ||
activeCommandI = undefined; | ||
} | ||
} | ||
}) | ||
.on('cxttapend tapend', function(e){ | ||
if (options.openMenuEvents === 'tap') { | ||
var ele = this; | ||
if (activeCommandI !== undefined) { | ||
var select = commands[ activeCommandI ].select; | ||
if (select) { | ||
select.apply(ele, [ele, gestureStartEvent]); | ||
activeCommandI = undefined; | ||
} | ||
} | ||
} | ||
parent.style.display = 'none'; | ||
inGesture = false; | ||
restoreGestures(); | ||
@@ -588,0 +578,0 @@ }) |
{ | ||
"name": "cytoscape-cxtmenu", | ||
"version": "2.9.4", | ||
"version": "2.9.5", | ||
"description": "A context menu for Cytoscape.js", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-cxtmenu.js", |
Sorry, the diff of this file is not supported yet
604183
1939