cytoscape
Advanced tools
Comparing version 2.7.11 to 2.7.12
{ | ||
"name": "cytoscape", | ||
"version": "2.7.11", | ||
"version": "2.7.12", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Graph theory (a.k.a. network) library for analysis and visualisation", |
@@ -21,15 +21,30 @@ 'use strict'; | ||
var hasCompounds = cy.hasCompoundNodes(); | ||
var style = cy.style(); | ||
var updatedEles = this; | ||
notifyRenderer = notifyRenderer || notifyRenderer === undefined ? true : false; | ||
style.apply( this ); | ||
if( hasCompounds ){ // then add everything up and down for compound selector checks | ||
updatedEles = this.spawnSelf().merge( this.descendants() ).merge( this.parents() ); | ||
} | ||
var updatedCompounds = this.updateCompoundBounds(); | ||
var toNotify = updatedCompounds.length > 0 ? this.add( updatedCompounds ) : this; | ||
style.apply( updatedEles ); | ||
if( hasCompounds ){ | ||
var updatedCompounds = updatedEles.updateCompoundBounds(); | ||
// disable for performance for now | ||
// (as updatedCompounds would be a subset of updatedEles ayway b/c of selectors check) | ||
// if( updatedCompounds.length > 0 ){ | ||
// updatedEles.merge( updatedCompounds ); | ||
// } | ||
} | ||
if( notifyRenderer ){ | ||
toNotify.rtrigger( 'style' ); // let renderer know we changed style | ||
updatedEles.rtrigger( 'style' ); // let renderer know we changed style | ||
} else { | ||
toNotify.trigger( 'style' ); // just fire the event | ||
updatedEles.trigger( 'style' ); // just fire the event | ||
} | ||
return this; // chaining | ||
@@ -36,0 +51,0 @@ }, |
@@ -282,2 +282,3 @@ 'use strict'; | ||
addEle( node, 0 ); | ||
return true; | ||
} | ||
@@ -334,2 +335,3 @@ | ||
addEle( edge, sqDist ); | ||
return true; | ||
} | ||
@@ -347,2 +349,3 @@ } | ||
addEle( edge, sqDist ); | ||
return true; | ||
} | ||
@@ -404,17 +407,22 @@ } | ||
if( ele.pstyle( 'text-events' ).strValue === 'no' ){ return; } | ||
var text = ele.pstyle( prefixDash + 'label' ).value; | ||
var eventsEnabled = ele.pstyle( 'text-events' ).strValue === 'yes'; | ||
var rotation = ele.pstyle( prefixDash + 'text-rotation' ); | ||
if( !eventsEnabled || !text ){ return; } | ||
// adjust bb w/ angle | ||
if( rotation.strValue === 'autorotate' || !!rotation.pfValue ){ | ||
var rstyle = _p.rstyle; | ||
var bw = ele.pstyle('text-border-width').pfValue; | ||
var lw = preprop( rstyle, 'labelWidth', prefix ) + bw/2 + 2*th; | ||
var lh = preprop( rstyle, 'labelHeight', prefix ) + bw/2 + 2*th; | ||
var lx = preprop( rstyle, 'labelX', prefix ); | ||
var ly = preprop( rstyle, 'labelY', prefix ); | ||
var rstyle = _p.rstyle; | ||
var bw = ele.pstyle('text-border-width').pfValue; | ||
var lw = preprop( rstyle, 'labelWidth', prefix ) + bw/2 + 2*th; | ||
var lh = preprop( rstyle, 'labelHeight', prefix ) + bw/2 + 2*th; | ||
var lx = preprop( rstyle, 'labelX', prefix ); | ||
var ly = preprop( rstyle, 'labelY', prefix ); | ||
var theta = preprop( _p.rscratch, 'labelAngle', prefix ); | ||
var theta = preprop( _p.rscratch, 'labelAngle', prefix ); | ||
var lx1 = lx - lw / 2; | ||
var lx2 = lx + lw / 2; | ||
var ly1 = ly - lh / 2; | ||
var ly2 = ly + lh / 2; | ||
if( theta ){ | ||
var cos = Math.cos( theta ); | ||
@@ -433,7 +441,2 @@ var sin = Math.sin( theta ); | ||
var lx1 = lx - lw / 2; | ||
var lx2 = lx + lw / 2; | ||
var ly1 = ly - lh / 2; | ||
var ly2 = ly + lh / 2; | ||
var px1y1 = rotate( lx1, ly1 ); | ||
@@ -453,21 +456,17 @@ var px1y2 = rotate( lx1, ly2 ); | ||
addEle( ele ); | ||
return true; | ||
} | ||
} else { // do a cheaper bb check | ||
var bb = { | ||
w: lw, | ||
h: lh, | ||
x1: lx1, | ||
x2: lx2, | ||
y1: ly1, | ||
y2: ly2 | ||
}; | ||
} else { | ||
var bb = ele.boundingBox( { | ||
includeLabels: true, | ||
includeNodes: false, | ||
includeEdges: false | ||
} ); | ||
// adjust bb w/ threshold | ||
bb.x1 -= th; | ||
bb.y1 -= th; | ||
bb.x2 += th; | ||
bb.y2 += th; | ||
bb.w = bb.x2 - bb.x1; | ||
bb.h = bb.y2 - bb.y1; | ||
if( math.inBoundingBox( bb, x, y ) ){ | ||
addEle( ele ); | ||
return true; | ||
} | ||
@@ -482,12 +481,6 @@ } | ||
if( ele.isNode() ){ | ||
checkNode( ele ); | ||
checkNode( ele ) || checkLabel( ele ); | ||
checkLabel( ele ); | ||
} else { // then edge | ||
checkEdge( ele ); | ||
checkLabel( ele ); | ||
checkLabel( ele, 'source' ); | ||
checkLabel( ele, 'target' ); | ||
checkEdge( ele ) || checkLabel( ele ) || checkLabel( ele, 'source' ) || checkLabel( ele, 'target' ); | ||
} | ||
@@ -607,3 +600,3 @@ } | ||
var grabTarget; | ||
var grabTargets = []; | ||
@@ -614,4 +607,4 @@ for( var i = 0; i < eles.length; i++ ){ | ||
if( rs.isGrabTarget && !ele.isParent() ){ | ||
grabTarget = ele; | ||
if( ele.grabbed() && !ele.isParent() ){ | ||
grabTargets.push( ele ); | ||
} else if( rs.inDragLayer ){ | ||
@@ -624,5 +617,7 @@ eles.drag.push( ele ); | ||
// put the grab target node last so it's on top of its neighbourhood | ||
if( grabTarget ){ | ||
eles.drag.push( grabTarget ); | ||
// put the grab target nodes last so it's on top of its neighbourhood | ||
for( var i = 0; i < grabTargets.length; i++ ){ | ||
var ele = grabTargets[i]; | ||
eles.drag.push( ele ); | ||
} | ||
@@ -629,0 +624,0 @@ }; |
@@ -5,3 +5,3 @@ 'use strict'; | ||
BRp.getCachedImage = function( url, onLoad ){ | ||
BRp.getCachedImage = function( url, crossOrigin, onLoad ){ | ||
var r = this; | ||
@@ -28,3 +28,3 @@ var imageCache = r.imageCache = r.imageCache || {}; | ||
if( !isDataUri ){ | ||
image.crossOrigin = 'Anonymous'; // prevent tainted canvas | ||
image.crossOrigin = crossOrigin; // prevent tainted canvas | ||
} | ||
@@ -31,0 +31,0 @@ |
@@ -50,4 +50,6 @@ 'use strict'; | ||
var bgImgCrossOrigin = node.pstyle( 'background-image-crossorigin' ); | ||
// get image, and if not loaded then ask to redraw when later loaded | ||
image = this.getCachedImage( url, function(){ | ||
image = this.getCachedImage( url, bgImgCrossOrigin, function(){ | ||
node.trigger('background'); | ||
@@ -54,0 +56,0 @@ |
@@ -395,3 +395,3 @@ 'use strict'; | ||
name: name, | ||
value: value, | ||
value: '' + value, | ||
strValue: '' + value, | ||
@@ -398,0 +398,0 @@ bypass: propIsBypass |
@@ -38,2 +38,3 @@ 'use strict'; | ||
bgFit: { enums: [ 'none', 'contain', 'cover' ] }, | ||
bgCrossOrigin: { enums: [ 'anonymous', 'use-credentials' ] }, | ||
bgClip: { enums: [ 'none', 'node' ] }, | ||
@@ -200,2 +201,3 @@ color: { color: true }, | ||
{ name: 'background-image', type: t.url }, | ||
{ name: 'background-image-crossorigin', type: t.bgCrossOrigin }, | ||
{ name: 'background-image-opacity', type: t.zeroOneNumber }, | ||
@@ -371,2 +373,3 @@ { name: 'background-position-x', type: t.bgPos }, | ||
'background-image': 'none', | ||
'background-image-crossorigin': 'anonymous', | ||
'background-image-opacity': 1, | ||
@@ -373,0 +376,0 @@ 'background-position-x': '50%', |
@@ -9,6 +9,3 @@ 'use strict'; | ||
var raf = !window ? null : ( window.requestAnimationFrame || window.mozRequestAnimationFrame || | ||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame ); | ||
raf = raf || function( fn ){ | ||
var raf = !window ? function( fn ){ | ||
if( fn ){ | ||
@@ -19,3 +16,13 @@ setTimeout( function(){ | ||
} | ||
}; | ||
} : (function(){ | ||
if( window.requestAnimationFrame ){ | ||
return function( fn ){ window.requestAnimationFrame( fn ); }; | ||
} else if( window.mozRequestAnimationFrame ){ | ||
return function( fn ){ window.mozRequestAnimationFrame( fn ); }; | ||
} else if( window.webkitRequestAnimationFrame ){ | ||
return function( fn ){ window.webkitRequestAnimationFrame( fn ); }; | ||
} else if( window.msRequestAnimationFrame ){ | ||
return function( fn ){ window.msRequestAnimationFrame( fn ); }; | ||
} | ||
})(); | ||
@@ -22,0 +29,0 @@ util.requestAnimationFrame = function( fn ){ |
@@ -1,1 +0,1 @@ | ||
"2.7.11" | ||
"2.7.12" |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
4320250
122
43590
1
4
4