cytoscape-edgehandles
Advanced tools
Comparing version 2.3.1 to 2.3.2
@@ -262,3 +262,21 @@ /*! | ||
// ported lodash throttle function | ||
var throttle = function( func, wait, options ){ | ||
var leading = true, | ||
trailing = true; | ||
if( options === false ){ | ||
leading = false; | ||
} else if( typeof options === typeof {} ){ | ||
leading = 'leading' in options ? options.leading : leading; | ||
trailing = 'trailing' in options ? options.trailing : trailing; | ||
} | ||
options = options || {}; | ||
options.leading = leading; | ||
options.maxWait = wait; | ||
options.trailing = trailing; | ||
return debounce( func, wait, options ); | ||
}; | ||
// registers the extension on a cytoscape lib ref | ||
@@ -314,3 +332,4 @@ var register = function( $$, $ ) { | ||
var edgehandles = function( params, cy ) { | ||
var edgehandles = function( params ) { | ||
var cy = this; | ||
var fn = params; | ||
@@ -569,13 +588,6 @@ var container = cy.container(); | ||
var lineDrawRate = 1000 / 30; | ||
var lastDrawLine = 0; | ||
var drawLine = function( hx, hy, x, y ) { | ||
var now = +new Date(); | ||
var lineDrawRate = 1000 / 60; | ||
if( now - lastDrawLine < lineDrawRate ) { | ||
return; | ||
} | ||
var drawLine = throttle( function( hx, hy, x, y ) { | ||
lastDrawLine = now; | ||
if( options().handleLineType !== 'ghost' ) { | ||
@@ -664,3 +676,3 @@ ctx.fillStyle = options().handleColor; | ||
} | ||
}; | ||
}, lineDrawRate, { leading: true } ); | ||
@@ -1302,8 +1314,4 @@ function makeEdges( preview, src, tgt ) { | ||
$$( 'core', 'edgehandles', function( options ) { | ||
var cy = this; | ||
$$( 'core', 'edgehandles', edgehandles ); | ||
return edgehandles( options, cy ); | ||
} ); | ||
}; | ||
@@ -1325,2 +1333,2 @@ | ||
} )( cytoscape, jQuery ); | ||
} )( typeof cytoscape !== 'undefined' ? cytoscape : null, typeof jQuery !== 'undefined' ? jQuery : null ); |
{ | ||
"name": "cytoscape-edgehandles", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"description": "Edge creation extension for Cytoscape.js", | ||
@@ -5,0 +5,0 @@ "main": "cytoscape-edgehandles.js", |
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
88684
1138