@neo4j-nvl/layout-workers 0.2.12 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import { layout } from './cose-bilkent-layout-impl.js';
2
2
  const onMessage = ({ data, target }) => {
3
3
  if (target.name === 'CoseBilkentLayout') {
4
- const { elements, boundingBox, spacingFactor, nodeCenterPoint } = data;
5
- const layoutData = layout(elements, boundingBox, spacingFactor, nodeCenterPoint);
4
+ const { elements, spacingFactor } = data;
5
+ const layoutData = layout(elements, spacingFactor);
6
6
  postMessage(layoutData);
7
7
  }
8
8
  };
@@ -1,3 +1,3 @@
1
- export function layout(elements: any, boundingBox: any, spacingFactor: any, nodeCenterPoint: any): {
1
+ export function layout(elements: any, spacingFactor: any): {
2
2
  positions: {};
3
3
  };
@@ -2,11 +2,10 @@ import cytoscape from 'cytoscape';
2
2
  import coseBilkent from 'cytoscape-cose-bilkent';
3
3
  cytoscape.use(coseBilkent);
4
4
  const type = 'cose-bilkent';
5
- export const layout = (elements, boundingBox, spacingFactor, nodeCenterPoint) => {
5
+ export const layout = (elements, spacingFactor) => {
6
6
  const c = cytoscape({
7
7
  headless: true,
8
- styleEnabled: false,
9
- boundingBox
8
+ styleEnabled: false
10
9
  });
11
10
  c.add(elements);
12
11
  const positions = {};
@@ -20,8 +19,6 @@ export const layout = (elements, boundingBox, spacingFactor, nodeCenterPoint) =>
20
19
  stop: () => {
21
20
  c.nodes().forEach((n) => {
22
21
  positions[n.id()] = { ...n.position() };
23
- positions[n.id()].x += nodeCenterPoint[0];
24
- positions[n.id()].y += nodeCenterPoint[1];
25
22
  });
26
23
  }
27
24
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-nvl/layout-workers",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "license": "SEE LICENSE IN 'Neo4j Early Access Agreement - Visualization Library.pdf'",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",