@html-graph/html-graph 8.20.0 → 8.21.0

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.
@@ -2498,10 +2498,24 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2498
2498
  });
2499
2499
  }
2500
2500
  }
2501
+ const boxPortOffsetFn = (params) => {
2502
+ const { direction, radius } = params;
2503
+ const { x, y } = direction;
2504
+ const { horizontal, vertical } = radius;
2505
+ const tg = y / x;
2506
+ const horX = Math.abs(vertical / tg);
2507
+ const vertY = Math.abs(horizontal * tg);
2508
+ const minX = Math.min(horizontal, horX);
2509
+ const minY = Math.min(vertical, vertY);
2510
+ return Math.sqrt(minX * minX + minY * minY);
2511
+ };
2501
2512
  const resolvePortOffsetFn = (offset) => {
2502
2513
  if (typeof offset === "number") {
2503
2514
  return () => offset;
2504
2515
  }
2516
+ if (offset === "box") {
2517
+ return boxPortOffsetFn;
2518
+ }
2505
2519
  return offset;
2506
2520
  };
2507
2521
  const defaultPortOffset = edgeConstants.portOffset;
@@ -2655,17 +2669,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2655
2669
  });
2656
2670
  }
2657
2671
  }
2658
- const boxPortOffsetFn = (params) => {
2659
- const { direction, radius } = params;
2660
- const { x, y } = direction;
2661
- const { horizontal, vertical } = radius;
2662
- const tg = y / x;
2663
- const horX = Math.abs(vertical / tg);
2664
- const vertY = Math.abs(horizontal * tg);
2665
- const minX = Math.min(horizontal, horX);
2666
- const minY = Math.min(vertical, vertY);
2667
- return Math.sqrt(minX * minX + minY * minY);
2668
- };
2669
2672
  const createEdgeGroup = () => {
2670
2673
  const group = document.createElementNS("http://www.w3.org/2000/svg", "g");
2671
2674
  group.style.pointerEvents = "auto";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@html-graph/html-graph",
3
3
  "author": "Dmitry Marov <d.marov94@gmail.com>",
4
4
  "private": false,
5
- "version": "8.20.0",
5
+ "version": "8.21.0",
6
6
  "type": "module",
7
7
  "main": "dist/html-graph.js",
8
8
  "types": "dist/html-graph.d.ts",