@logicflow/core 1.2.0-alpha.11 → 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.10\"}");
11340
+ module.exports = JSON.parse("{\"a\":\"1.2.0-alpha.13\"}");
11341
11341
 
11342
11342
  /***/ }),
11343
11343
  /* 162 */
@@ -22727,7 +22727,7 @@ var BaseEdgeModel_BaseEdgeModel = /*#__PURE__*/function () {
22727
22727
  BaseEdgeModel_defineProperty(this, "style", {});
22728
22728
 
22729
22729
  BaseEdgeModel_defineProperty(this, "arrowConfig", {
22730
- markerEnd: "url(#marker-end-".concat(this.id, ")"),
22730
+ markerEnd: '',
22731
22731
  markerStart: ''
22732
22732
  });
22733
22733
 
@@ -22824,6 +22824,8 @@ var BaseEdgeModel_BaseEdgeModel = /*#__PURE__*/function () {
22824
22824
  if (overlapMode === OverlapMode.INCREASE) {
22825
22825
  this.zIndex = data.zIndex || getZIndex();
22826
22826
  }
22827
+
22828
+ this.arrowConfig.markerEnd = "url(#marker-end-".concat(this.id, ")");
22827
22829
  }
22828
22830
  /**
22829
22831
  * 设置model属性,每次properties发生变化会触发
@@ -24990,14 +24992,41 @@ var edge_getBezierControlPoints = function getBezierControlPoints(_ref) {
24990
24992
  sourceNode = _ref.sourceNode,
24991
24993
  targetNode = _ref.targetNode,
24992
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;
24993
24997
  var sBBox = getNodeBBox(sourceNode);
24994
24998
  var tBBox = getNodeBBox(targetNode);
24995
24999
  var sExpendBBox = getExpandedBBox(sBBox, offset);
24996
25000
  var tExpendBBox = getExpandedBBox(tBBox, offset);
24997
25001
  var sDirection = edge_pointDirection(start, sourceNode);
25002
+ var tDirection = edge_pointDirection(end, targetNode); // 1. 避免两个节点连出的多个连线重合。
25003
+ // 2. 避免开始节点和结束节点方向相同时成为一个穿过节点的直线。
25004
+
24998
25005
  var sNext = edge_getExpandedBBoxPoint(sExpendBBox, start, sDirection);
24999
- var tDirection = edge_pointDirection(end, targetNode);
25000
- 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
+
25001
25030
  return {
25002
25031
  sNext: sNext,
25003
25032
  ePre: ePre
@@ -28966,7 +28995,7 @@ var BezierEdgeModel_BezierEdgeModel = /*#__PURE__*/function (_BaseEdgeModel) {
28966
28995
  BezierEdgeModel_createClass(BezierEdgeModel, [{
28967
28996
  key: "initEdgeData",
28968
28997
  value: function initEdgeData(data) {
28969
- this.offset = 100;
28998
+ this.offset = 0;
28970
28999
 
28971
29000
  BezierEdgeModel_get(BezierEdgeModel_getPrototypeOf(BezierEdgeModel.prototype), "initEdgeData", this).call(this, data);
28972
29001
  }
@@ -31404,7 +31433,9 @@ var Anchor_Anchor = /*#__PURE__*/function (_Component) {
31404
31433
  eventCenter = graphModel.eventCenter,
31405
31434
  width = graphModel.width,
31406
31435
  height = graphModel.height,
31407
- editConfigModel = graphModel.editConfigModel;
31436
+ _graphModel$editConfi = graphModel.editConfigModel,
31437
+ autoExpand = _graphModel$editConfi.autoExpand,
31438
+ stopMoveGraph = _graphModel$editConfi.stopMoveGraph;
31408
31439
  var clientX = event.clientX,
31409
31440
  clientY = event.clientY;
31410
31441
 
@@ -31444,7 +31475,7 @@ var Anchor_Anchor = /*#__PURE__*/function (_Component) {
31444
31475
 
31445
31476
  _this.moveAnchorEnd(x1, y1);
31446
31477
 
31447
- if (nearBoundary.length > 0 && !editConfigModel.stopMoveGraph) {
31478
+ if (nearBoundary.length > 0 && !stopMoveGraph && autoExpand) {
31448
31479
  _this.t = setInterval(function () {
31449
31480
  var _nearBoundary = nearBoundary,
31450
31481
  _nearBoundary2 = Anchor_slicedToArray(_nearBoundary, 2),
@@ -35479,7 +35510,11 @@ var History_History = /*#__PURE__*/function () {
35479
35510
 
35480
35511
  this.eventCenter = graphModel.eventCenter;
35481
35512
  var NODE_ADD = EventType.NODE_ADD,
35513
+ NODE_DELETE = EventType.NODE_DELETE,
35514
+ NODE_DND_ADD = EventType.NODE_DND_ADD,
35482
35515
  EDGE_ADD = EventType.EDGE_ADD,
35516
+ EDGE_DELETE = EventType.EDGE_DELETE,
35517
+ TEXT_UPDATE = EventType.TEXT_UPDATE,
35483
35518
  NODE_DROP = EventType.NODE_DROP,
35484
35519
  EDGE_ADJUST = EventType.EDGE_ADJUST,
35485
35520
  SELECTION_DROP = EventType.SELECTION_DROP,
@@ -35490,7 +35525,7 @@ var History_History = /*#__PURE__*/function () {
35490
35525
  NODE_PROPERTY_UPDATE = EventType.NODE_PROPERTY_UPDATE,
35491
35526
  EDGE_PROPERTY_UPDATE = EventType.EDGE_PROPERTY_UPDATE,
35492
35527
  HISTORY_INSERT = EventType.HISTORY_INSERT;
35493
- var historyChangeKeys = "\n ".concat(NODE_ADD, ",\n ").concat(EDGE_ADD, ",\n ").concat(NODE_DROP, ",\n ").concat(EDGE_ADJUST, ",\n ").concat(SELECTION_DROP, ",\n ").concat(TEXT_DROP, ",\n ").concat(NODE_TEXT_UPDATE, ",\n ").concat(EDGE_TEXT_UPDATE, ",\n ").concat(GRAPH_RENDERED, "\n ");
35528
+ var historyChangeKeys = "\n ".concat(NODE_ADD, ",\n ").concat(EDGE_ADD, ",\n ").concat(NODE_DELETE, ",\n ").concat(NODE_DND_ADD, ",\n ").concat(EDGE_DELETE, ",\n ").concat(TEXT_UPDATE, ",\n ").concat(NODE_DROP, ",\n ").concat(EDGE_ADJUST, ",\n ").concat(SELECTION_DROP, ",\n ").concat(TEXT_DROP, ",\n ").concat(NODE_TEXT_UPDATE, ",\n ").concat(EDGE_TEXT_UPDATE, ",\n ").concat(GRAPH_RENDERED, "\n ");
35494
35529
 
35495
35530
  if (isPropertiesChangeHistory) {
35496
35531
  historyChangeKeys += ",".concat(NODE_PROPERTY_UPDATE, ",").concat(EDGE_PROPERTY_UPDATE);