@html-graph/html-graph 8.21.0 → 8.21.1

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.
@@ -1271,6 +1271,8 @@ const createEdgeRectangle = (source, target, padding) => {
1271
1271
  to: { x: to.x - x, y: to.y - y }
1272
1272
  };
1273
1273
  };
1274
+ const halfCube = 0.5 * 0.5 * 0.5;
1275
+ const halfCube3 = 3 * halfCube;
1274
1276
  class BezierEdgePath {
1275
1277
  constructor(params) {
1276
1278
  __publicField(this, "path");
@@ -1285,9 +1287,6 @@ class BezierEdgePath {
1285
1287
  hasSourceArrow,
1286
1288
  hasTargetArrow
1287
1289
  } = params;
1288
- const centerX = (from.x + to.x) / 2;
1289
- const centerY = (from.y + to.y) / 2;
1290
- this.midpoint = { x: centerX, y: centerY };
1291
1290
  const begin = createRotatedPoint(
1292
1291
  { x: from.x + arrowLength, y: from.y },
1293
1292
  fromDir,
@@ -1306,6 +1305,9 @@ class BezierEdgePath {
1306
1305
  x: end.x - toDir.x * curvature,
1307
1306
  y: end.y - toDir.y * curvature
1308
1307
  };
1308
+ const centerX = halfCube * begin.x + halfCube3 * bezierBegin.x + halfCube3 * bezierEnd.x + halfCube * end.x;
1309
+ const centerY = halfCube * begin.y + halfCube3 * bezierBegin.y + halfCube3 * bezierEnd.y + halfCube * end.y;
1310
+ this.midpoint = { x: centerX, y: centerY };
1309
1311
  const curve = `M ${begin.x} ${begin.y} C ${bezierBegin.x} ${bezierBegin.y}, ${bezierEnd.x} ${bezierEnd.y}, ${end.x} ${end.y}`;
1310
1312
  const preLine = hasSourceArrow ? "" : `M ${from.x} ${from.y} L ${begin.x} ${begin.y} `;
1311
1313
  const postLine = hasTargetArrow ? "" : ` M ${end.x} ${end.y} L ${to.x} ${to.y}`;