@neo4j-nvl/layout-workers
Advanced tools
Comparing version 0.3.5 to 0.3.6-379b7fef
@@ -73,10 +73,2 @@ import dagre from '@neo4j-bloom/dagre'; | ||
}; | ||
const findParent = (id, layoutGraph) => { | ||
// predecessors uses inEdges, successors uses outEdges | ||
let pId = findParentForEdges(id, layoutGraph.predecessors(id), layoutGraph); | ||
if (pId === null) { | ||
pId = findParentForEdges(id, layoutGraph.successors(id), layoutGraph); | ||
} | ||
return pId; | ||
}; | ||
const findParentForEdges = (id, connectedNodes, layoutGraph) => { | ||
@@ -103,2 +95,10 @@ const { rank: currentRank } = layoutGraph.node(id); | ||
}; | ||
const findParent = (id, layoutGraph) => { | ||
// predecessors uses inEdges, successors uses outEdges | ||
let pId = findParentForEdges(id, layoutGraph.predecessors(id), layoutGraph); | ||
if (pId === null) { | ||
pId = findParentForEdges(id, layoutGraph.successors(id), layoutGraph); | ||
} | ||
return pId; | ||
}; | ||
const getConnectedSubGraphs = (g, pixelRatio) => { | ||
@@ -131,5 +131,5 @@ const subGraphs = []; | ||
g.graph().rankdir = Directions[direction]; | ||
const layoutGraph = dagre.layout(g); | ||
for (const id of layoutGraph.nodes()) { | ||
const pId = findParent(id, layoutGraph); | ||
const dagreLayoutGraph = dagre.layout(g); | ||
for (const id of dagreLayoutGraph.nodes()) { | ||
const pId = findParent(id, dagreLayoutGraph); | ||
if (pId !== null) { | ||
@@ -195,4 +195,4 @@ parents[id] = pId; | ||
const isNatural = isDirectionNatural(direction); | ||
const singleNodeGraphs = subGraphs.filter((g) => g.nodeCount() === 1); | ||
const multiNodeGraphs = subGraphs.filter((g) => g.nodeCount() !== 1); | ||
const singleNodeGraphs = subGraphs.filter((sg) => sg.nodeCount() === 1); | ||
const multiNodeGraphs = subGraphs.filter((sg) => sg.nodeCount() !== 1); | ||
if (packing === PackingBin) { | ||
@@ -221,6 +221,8 @@ multiNodeGraphs.sort((a, b) => b.nodeCount() - a.nodeCount()); | ||
const extentProp = isVertical ? 'height' : 'width'; | ||
const min = bins.reduce((min, d) => (min === null ? d[positionProp] : Math.min(d[positionProp], min[extentProp] || 0)), null); | ||
const max = bins.reduce((max, d) => max === null | ||
? d[positionProp] + d[extentProp] | ||
: Math.max(d[positionProp] + d[extentProp], max[extentProp] || 0), null); | ||
const min = bins.reduce((minBin, d) => (minBin === null ? d[positionProp] : Math.min(d[positionProp], minBin[extentProp] || 0)), null); | ||
const max = bins.reduce((maxBin, d) => { | ||
return maxBin === null | ||
? d[positionProp] + d[extentProp] | ||
: Math.max(d[positionProp] + d[extentProp], maxBin[extentProp] || 0); | ||
}, null); | ||
bins.forEach((d) => { | ||
@@ -227,0 +229,0 @@ d[positionProp] = min + (max - (d[positionProp] + d[extentProp])); |
{ | ||
"name": "@neo4j-nvl/layout-workers", | ||
"version": "0.3.5", | ||
"version": "0.3.6-379b7fef", | ||
"license": "SEE LICENSE IN 'LICENSE.txt'", | ||
@@ -25,3 +25,3 @@ "description": "Layout workers for the Neo4j Visualization Library", | ||
"postpack": "rm LICENSE.txt", | ||
"eslint": "yarn global:eslint ./src/ --ext .js,.mjs --plugin only-warn" | ||
"eslint": "yarn global:eslint ./src/ --ext .js,.mjs" | ||
}, | ||
@@ -43,3 +43,4 @@ "typedoc": { | ||
"@types/node": "^18.11.11" | ||
} | ||
}, | ||
"stableVersion": "0.3.6" | ||
} |
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
52723
642