@logicflow/core 1.2.0-alpha.8 → 1.2.0-alpha.9

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.
@@ -24326,16 +24326,21 @@ var getExpandedBBox = function getExpandedBBox(bbox, offset) {
24326
24326
  */
24327
24327
 
24328
24328
  var edge_pointDirection = function pointDirection(point, node) {
24329
- var yDistance = point.y - node.y;
24330
- var xDistance = point.x - node.x;
24331
- if (yDistance === 0) return SegmentDirection.HORIZONTAL;
24332
- if (xDistance === 0) return SegmentDirection.VERTICAL;
24329
+ var dx = Math.abs(point.x - node.x);
24330
+ var dy = Math.abs(point.y - node.y);
24331
+ var width = node.width,
24332
+ height = node.height;
24333
+ var hDistance = width / 2 - dx; // 锚点距离节点左右两边的最小距离,值大于0表示在minX与maxX之间
24334
+
24335
+ var vDistance = height / 2 - dy; // 锚点距离节点上下两边的最小距离,值大于0表示在minY与maxY之间
24336
+
24337
+ if (hDistance > 0 && vDistance > 0) {
24338
+ // 锚点在节点内部,寻找与锚点距离最近的边的方向
24339
+ return hDistance < vDistance ? SegmentDirection.HORIZONTAL : SegmentDirection.VERTICAL;
24340
+ } // 锚点在节点边上或者节点外部,比较锚点斜率(dy/dx)与节点斜率(height/width)
24333
24341
 
24334
- if (point.x > node.x - node.width / 2 && point.x < node.x + node.width / 2) {
24335
- return SegmentDirection.VERTICAL;
24336
- }
24337
24342
 
24338
- return SegmentDirection.HORIZONTAL;
24343
+ return dx / node.width > dy / node.height ? SegmentDirection.HORIZONTAL : SegmentDirection.VERTICAL;
24339
24344
  };
24340
24345
  /* 获取扩展图形上的点,即起始终点相邻的点,上一个或者下一个节点 */
24341
24346
 
@@ -35846,11 +35851,12 @@ var TextEditTool_TextEdit = stateUtil_observer(TextEditTool_class = (_temp = _cl
35846
35851
  left = _transformModel$Canva2[0],
35847
35852
  top = _transformModel$Canva2[1];
35848
35853
 
35854
+ var textStyle = textEditElement.getTextStyle();
35849
35855
  return {
35850
- style: TextEditTool_objectSpread({
35856
+ style: TextEditTool_objectSpread(TextEditTool_objectSpread({
35851
35857
  left: left,
35852
35858
  top: top
35853
- }, autoStyle)
35859
+ }, autoStyle), textStyle)
35854
35860
  };
35855
35861
  }
35856
35862
  }