cytoscape
Advanced tools
Comparing version 3.26.1 to 3.27.0
{ | ||
"name": "cytoscape", | ||
"version": "3.26.1", | ||
"version": "3.27.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Graph theory (a.k.a. network) library for analysis and visualisation", |
@@ -11,2 +11,3 @@ import * as util from '../../util'; | ||
padding: 30, // padding on fit | ||
spacingFactor: undefined, // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up | ||
animate: false, // whether to transition the node positions | ||
@@ -13,0 +14,0 @@ animationDuration: 500, // duration of animation in ms if enabled |
@@ -8,2 +8,53 @@ import * as math from '../../../../math'; | ||
BRp.findMidptPtsEtc = function(edge, pairInfo) { | ||
let { posPts, intersectionPts, vectorNormInverse } = pairInfo; | ||
let midptPts; | ||
// n.b. assumes all edges in bezier bundle have same endpoints specified | ||
let srcManEndpt = edge.pstyle('source-endpoint'); | ||
let tgtManEndpt = edge.pstyle('target-endpoint'); | ||
const haveManualEndPts = srcManEndpt.units != null && tgtManEndpt.units != null; | ||
const recalcVectorNormInverse = (x1, y1, x2, y2) => { | ||
let dy = ( y2 - y1 ); | ||
let dx = ( x2 - x1 ); | ||
let l = Math.sqrt( dx * dx + dy * dy ); | ||
return { | ||
x: -dy / l, | ||
y: dx / l | ||
}; | ||
}; | ||
const edgeDistances = edge.pstyle('edge-distances').value; | ||
switch(edgeDistances) { | ||
case 'node-position': | ||
midptPts = posPts; | ||
break; | ||
case 'intersection': | ||
midptPts = intersectionPts; | ||
break; | ||
case 'endpoints': { | ||
if (haveManualEndPts) { | ||
const [x1, y1] = this.manualEndptToPx( edge.source()[0], srcManEndpt ); | ||
const [x2, y2] = this.manualEndptToPx( edge.target()[0], tgtManEndpt ); | ||
const endPts = { x1, y1, x2, y2 }; | ||
vectorNormInverse = recalcVectorNormInverse(x1, y1, x2, y2); | ||
midptPts = endPts; | ||
} else { | ||
util.warn(`Edge ${edge.id()} has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).`); | ||
midptPts = intersectionPts; // back to default | ||
} | ||
break; | ||
} | ||
} | ||
return { midptPts, vectorNormInverse }; | ||
}; | ||
BRp.findHaystackPoints = function( edges ){ | ||
@@ -68,4 +119,2 @@ for( let i = 0; i < edges.length; i++ ){ | ||
const rs = edge._private.rscratch; | ||
const { posPts, intersectionPts, vectorNormInverse } = pairInfo; | ||
const edgeDistances = edge.pstyle('edge-distances').value; | ||
const segmentWs = edge.pstyle( 'segment-weights' ); | ||
@@ -85,3 +134,3 @@ const segmentDs = edge.pstyle( 'segment-distances' ); | ||
let midptPts = edgeDistances === 'node-position' ? posPts : intersectionPts; | ||
let { midptPts, vectorNormInverse } = this.findMidptPtsEtc(edge, pairInfo); | ||
@@ -198,4 +247,2 @@ let adjustedMidpt = { | ||
const rs = edge._private.rscratch; | ||
const { vectorNormInverse, posPts, intersectionPts } = pairInfo; | ||
const edgeDistances = edge.pstyle('edge-distances').value; | ||
const stepSize = edge.pstyle('control-point-step-size').pfValue; | ||
@@ -237,3 +284,3 @@ const ctrlptDists = edge.pstyle('control-point-distances'); | ||
let midptPts = edgeDistances === 'node-position' ? posPts : intersectionPts; | ||
let { midptPts, vectorNormInverse } = this.findMidptPtsEtc(edge, pairInfo); | ||
@@ -240,0 +287,0 @@ let adjustedMidpt = { |
@@ -32,2 +32,3 @@ import * as util from '../util'; | ||
nonNegativeInt: { number: true, min: 0, integer: true, unitless: true }, | ||
nonNegativeNumber: { number: true, min: 0, unitless: true }, | ||
position: { enums: [ 'parent', 'origin' ] }, | ||
@@ -100,3 +101,3 @@ nodeSize: { number: true, min: 0, enums: [ 'label' ] }, | ||
polygonPointList: { number: true, multiple: true, evenMultiple: true, min: -1, max: 1, unitless: true }, | ||
edgeDistances: { enums: ['intersection', 'node-position'] }, | ||
edgeDistances: { enums: ['intersection', 'node-position', 'endpoints'] }, | ||
edgeEndpoint: { | ||
@@ -246,3 +247,3 @@ number: true, multiple: true, units: '%|px|em|deg|rad', implicitUnits: 'px', | ||
{ name: 'z-index-compare', type: t.zIndexCompare, triggersZOrder: diff.any }, | ||
{ name: 'z-index', type: t.nonNegativeInt, triggersZOrder: diff.any } | ||
{ name: 'z-index', type: t.number, triggersZOrder: diff.any } | ||
]; | ||
@@ -249,0 +250,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
4397771
112064