cytoscape-cxtmenu
Advanced tools
Comparing version 2.1.5 to 2.1.6
{ | ||
"name": "cytoscape-cxtmenu", | ||
"version": "2.1.5", | ||
"version": "2.1.6", | ||
"description": "A context menu for Cytoscape.js", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-cxtmenu.js", |
@@ -15,3 +15,3 @@ ;(function( $ ){ 'use strict'; | ||
*/ | ||
], | ||
], | ||
fillColor: 'rgba(0, 0, 0, 0.75)', // the background colour of the menu | ||
@@ -40,3 +40,3 @@ activeFillColor: 'rgba(92, 194, 237, 0.75)', // the colour used to indicate the selected command | ||
var target; | ||
function getOffset( $ele ){ | ||
@@ -53,3 +53,3 @@ var offset = $ele.offset(); | ||
} | ||
var data = { | ||
@@ -121,3 +121,3 @@ options: options, | ||
}); | ||
var $content = $('<div class="cxtmenu-content">' + command.content + '</div>'); | ||
@@ -130,3 +130,3 @@ $content.css({ | ||
}); | ||
$parent.append( $item ); | ||
@@ -175,3 +175,3 @@ $item.append( $content ); | ||
c2d.beginPath(); | ||
c2d.arc(r + options.activePadding, r + options.activePadding, r, 0, Math.PI*2, true); | ||
c2d.arc(r + options.activePadding, r + options.activePadding, r, 0, Math.PI*2, true); | ||
c2d.closePath(); | ||
@@ -208,8 +208,8 @@ c2d.fill(); | ||
} | ||
c2d.fillStyle = 'white'; | ||
c2d.globalCompositeOperation = 'destination-out'; | ||
c2d.beginPath(); | ||
c2d.arc(r + options.activePadding, r + options.activePadding, rspotlight + options.spotlightPadding, 0, Math.PI*2, true); | ||
c2d.arc(r + options.activePadding, r + options.activePadding, rspotlight + options.spotlightPadding, 0, Math.PI*2, true); | ||
c2d.closePath(); | ||
@@ -220,3 +220,3 @@ c2d.fill(); | ||
} | ||
var lastCallTime = 0; | ||
@@ -273,3 +273,16 @@ var minCallDelta = 1000/30; | ||
var dragHandler; | ||
var zoomEnabled; | ||
var restoreZoom = function(){ | ||
if( zoomEnabled ){ | ||
cy.userZoomingEnabled( true ); | ||
} | ||
}; | ||
var restoreGrab = function(){ | ||
if( grabbable ){ | ||
target.grabify(); | ||
} | ||
}; | ||
bindings | ||
@@ -281,2 +294,5 @@ .on('cxttapstart taphold', options.selector, function(e){ | ||
zoomEnabled = cy.userZoomingEnabled(); | ||
cy.userZoomingEnabled( false ); | ||
grabbable = target.grabbable && target.grabbable(); | ||
@@ -351,3 +367,3 @@ if( grabbable ){ | ||
var ry = dy*r / d; | ||
if( dy > 0 ){ | ||
@@ -373,3 +389,3 @@ theta = Math.PI + Math.abs(theta - Math.PI); | ||
// console.log('in command ' + i) | ||
c2d.fillStyle = options.activeFillColor; | ||
@@ -400,3 +416,3 @@ c2d.strokeStyle = 'black'; | ||
//c2d.arc(r + rx/r*(rs + options.spotlightPadding), r + ry/r*(rs + options.spotlightPadding), options.indicatorSize, 0, 2*Math.PI, true); | ||
c2d.translate( r + options.activePadding + rx/r*(rs + options.spotlightPadding - options.indicatorSize/4), r + options.activePadding + ry/r*(rs + options.spotlightPadding - options.indicatorSize/4) ); | ||
@@ -412,3 +428,3 @@ c2d.rotate( Math.PI/4 - theta ); | ||
c2d.beginPath(); | ||
c2d.arc(r + options.activePadding, r + options.activePadding, rs + options.spotlightPadding, 0, Math.PI*2, true); | ||
c2d.arc(r + options.activePadding, r + options.activePadding, rs + options.spotlightPadding, 0, Math.PI*2, true); | ||
c2d.closePath(); | ||
@@ -437,5 +453,4 @@ c2d.fill(); | ||
if( grabbable ){ | ||
target.grabify(); | ||
} | ||
restoreGrab(); | ||
restoreZoom(); | ||
}) | ||
@@ -448,5 +463,4 @@ | ||
if( grabbable ){ | ||
target.grabify(); | ||
} | ||
restoreGrab(); | ||
restoreZoom(); | ||
}) | ||
@@ -476,3 +490,3 @@ ; | ||
} | ||
addEventListeners(); | ||
@@ -479,0 +493,0 @@ |
{ | ||
"name": "cytoscape-cxtmenu", | ||
"version": "2.1.5", | ||
"version": "2.1.6", | ||
"description": "A context menu for Cytoscape.js", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-cxtmenu.js", |
598851
1840