@logicflow/core 1.2.0-alpha.13 → 1.2.0-alpha.14

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.
@@ -11337,7 +11337,7 @@ module.exports.f = function (C) {
11337
11337
  /* 161 */
11338
11338
  /***/ (function(module) {
11339
11339
 
11340
- module.exports = JSON.parse("{\"a\":\"1.2.0-alpha.12\"}");
11340
+ module.exports = JSON.parse("{\"a\":\"1.2.0-alpha.13\"}");
11341
11341
 
11342
11342
  /***/ }),
11343
11343
  /* 162 */
@@ -24992,14 +24992,41 @@ var edge_getBezierControlPoints = function getBezierControlPoints(_ref) {
24992
24992
  sourceNode = _ref.sourceNode,
24993
24993
  targetNode = _ref.targetNode,
24994
24994
  offset = _ref.offset;
24995
+ var nodeDistance = Math.max(Math.abs(sourceNode.x - targetNode.x), Math.abs(sourceNode.y - targetNode.y));
24996
+ offset = offset || nodeDistance / 4;
24995
24997
  var sBBox = getNodeBBox(sourceNode);
24996
24998
  var tBBox = getNodeBBox(targetNode);
24997
24999
  var sExpendBBox = getExpandedBBox(sBBox, offset);
24998
25000
  var tExpendBBox = getExpandedBBox(tBBox, offset);
24999
25001
  var sDirection = edge_pointDirection(start, sourceNode);
25002
+ var tDirection = edge_pointDirection(end, targetNode); // 1. 避免两个节点连出的多个连线重合。
25003
+ // 2. 避免开始节点和结束节点方向相同时成为一个穿过节点的直线。
25004
+
25000
25005
  var sNext = edge_getExpandedBBoxPoint(sExpendBBox, start, sDirection);
25001
- var tDirection = edge_pointDirection(end, targetNode);
25002
- var ePre = edge_getExpandedBBoxPoint(tExpendBBox, end, tDirection);
25006
+ var ePre = edge_getExpandedBBoxPoint(tExpendBBox, end, tDirection); // 计算起点的调整点是否需要偏移
25007
+ // 如果起点的调整点方向和连线方向相反,则添加偏移量
25008
+ // 如果终点的调整点方向与连线方向
25009
+
25010
+ var randomNumberX = Math.ceil((Math.random() + 0.5) * offset);
25011
+ var randomNumberY = Math.ceil((Math.random() + 0.5) * offset); // 如果是调整点在节点水平方向,那么调整的点Y需要向着另一个节点的方向进行一定随机量的偏移。
25012
+ // 如果是调整点在节点垂直方向,那么调整的点X需要向着另一个节点的方向进行一定随机量的偏移。
25013
+
25014
+ if (sDirection === SegmentDirection.HORIZONTAL) {
25015
+ sNext.y += sourceNode.y >= targetNode.y ? randomNumberY : -randomNumberY;
25016
+ }
25017
+
25018
+ if (sDirection === SegmentDirection.VERTICAL) {
25019
+ sNext.x += sourceNode.x >= targetNode.x ? randomNumberX : -randomNumberX;
25020
+ }
25021
+
25022
+ if (tDirection === SegmentDirection.HORIZONTAL) {
25023
+ ePre.y += sourceNode.y > targetNode.y ? randomNumberY : -randomNumberY;
25024
+ }
25025
+
25026
+ if (tDirection === SegmentDirection.VERTICAL) {
25027
+ ePre.x += sourceNode.x > targetNode.x ? randomNumberX : -randomNumberX;
25028
+ }
25029
+
25003
25030
  return {
25004
25031
  sNext: sNext,
25005
25032
  ePre: ePre
@@ -28968,7 +28995,7 @@ var BezierEdgeModel_BezierEdgeModel = /*#__PURE__*/function (_BaseEdgeModel) {
28968
28995
  BezierEdgeModel_createClass(BezierEdgeModel, [{
28969
28996
  key: "initEdgeData",
28970
28997
  value: function initEdgeData(data) {
28971
- this.offset = 100;
28998
+ this.offset = 0;
28972
28999
 
28973
29000
  BezierEdgeModel_get(BezierEdgeModel_getPrototypeOf(BezierEdgeModel.prototype), "initEdgeData", this).call(this, data);
28974
29001
  }