@logicflow/extension 2.3.0 → 2.3.1-alpha.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.
|
@@ -775,7 +775,7 @@ var DynamicGroup = /** @class */ (function () {
|
|
|
775
775
|
// 使用场景:addElements api 项目内部目前只在快捷键粘贴时使用(此处解决的也应该是粘贴场景的问题)
|
|
776
776
|
lf.addElements = function (_a, distance) {
|
|
777
777
|
var selectedNodes = _a.nodes, selectedEdges = _a.edges;
|
|
778
|
-
if (distance === void 0) { distance =
|
|
778
|
+
if (distance === void 0) { distance = 0; }
|
|
779
779
|
// oldNodeId -> newNodeId 映射 Map
|
|
780
780
|
var nodeIdMap = {};
|
|
781
781
|
// 本次添加的所有节点和边
|
|
@@ -41,6 +41,13 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
41
41
|
return ar;
|
|
42
42
|
};
|
|
43
43
|
import { PolylineEdge, PolylineEdgeModel, h } from '@logicflow/core';
|
|
44
|
+
// SVG 路径点只能是严格的 [x, y];多余坐标也视为格式错误,不能静默忽略。
|
|
45
|
+
var isFinitePointTuple = function (point) {
|
|
46
|
+
return Array.isArray(point) &&
|
|
47
|
+
point.length === 2 &&
|
|
48
|
+
Number.isFinite(point[0]) &&
|
|
49
|
+
Number.isFinite(point[1]);
|
|
50
|
+
};
|
|
44
51
|
// 方向组合到圆弧象限的映射。
|
|
45
52
|
// key 由进入方向(dir1)和离开方向(dir2)拼接,例如 'tr' 表示从上(t)到右(r)的拐角。
|
|
46
53
|
// 通过该映射确定在拐点处应该绘制的圆弧象限,用于计算中间控制点。
|
|
@@ -180,13 +187,21 @@ function getPartialPath(prevPoint, cornerPoint, nextPoint, cornerRadius) {
|
|
|
180
187
|
return path;
|
|
181
188
|
}
|
|
182
189
|
function getCurvedEdgePath(points, radius) {
|
|
190
|
+
// 这是可独立调用的导出函数,不能依赖 View 一定提前完成校验。
|
|
191
|
+
if (points.length === 0 || !points.every(isFinitePointTuple)) {
|
|
192
|
+
return '';
|
|
193
|
+
}
|
|
194
|
+
// i 始终指向下一个尚未写入路径的点:首点只生成 M,单点路径到此结束;
|
|
195
|
+
// 两点生成直线,三个及以上的点才为中间拐点计算圆角。
|
|
183
196
|
var i = 0;
|
|
184
|
-
var d =
|
|
197
|
+
var d = "M".concat(points[i][0], " ").concat(points[i++][1]);
|
|
198
|
+
if (points.length === 1) {
|
|
199
|
+
return d;
|
|
200
|
+
}
|
|
185
201
|
if (points.length === 2) {
|
|
186
|
-
d += "
|
|
202
|
+
d += " L ".concat(points[i][0], " ").concat(points[i][1]);
|
|
187
203
|
}
|
|
188
204
|
else {
|
|
189
|
-
d += "M".concat(points[i][0], " ").concat(points[i++][1]);
|
|
190
205
|
for (; i + 1 < points.length;) {
|
|
191
206
|
var prev = points[i - 1];
|
|
192
207
|
var cur = points[i];
|
|
@@ -792,7 +792,7 @@ var DynamicGroup = /** @class */ (function () {
|
|
|
792
792
|
// 使用场景:addElements api 项目内部目前只在快捷键粘贴时使用(此处解决的也应该是粘贴场景的问题)
|
|
793
793
|
lf.addElements = function (_a, distance) {
|
|
794
794
|
var selectedNodes = _a.nodes, selectedEdges = _a.edges;
|
|
795
|
-
if (distance === void 0) { distance =
|
|
795
|
+
if (distance === void 0) { distance = 0; }
|
|
796
796
|
// oldNodeId -> newNodeId 映射 Map
|
|
797
797
|
var nodeIdMap = {};
|
|
798
798
|
// 本次添加的所有节点和边
|
|
@@ -44,6 +44,13 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.getCurvedEdgePath = exports.CurvedEdgeModel = exports.CurvedEdge = void 0;
|
|
46
46
|
var core_1 = require("@logicflow/core");
|
|
47
|
+
// SVG 路径点只能是严格的 [x, y];多余坐标也视为格式错误,不能静默忽略。
|
|
48
|
+
var isFinitePointTuple = function (point) {
|
|
49
|
+
return Array.isArray(point) &&
|
|
50
|
+
point.length === 2 &&
|
|
51
|
+
Number.isFinite(point[0]) &&
|
|
52
|
+
Number.isFinite(point[1]);
|
|
53
|
+
};
|
|
47
54
|
// 方向组合到圆弧象限的映射。
|
|
48
55
|
// key 由进入方向(dir1)和离开方向(dir2)拼接,例如 'tr' 表示从上(t)到右(r)的拐角。
|
|
49
56
|
// 通过该映射确定在拐点处应该绘制的圆弧象限,用于计算中间控制点。
|
|
@@ -183,13 +190,21 @@ function getPartialPath(prevPoint, cornerPoint, nextPoint, cornerRadius) {
|
|
|
183
190
|
return path;
|
|
184
191
|
}
|
|
185
192
|
function getCurvedEdgePath(points, radius) {
|
|
193
|
+
// 这是可独立调用的导出函数,不能依赖 View 一定提前完成校验。
|
|
194
|
+
if (points.length === 0 || !points.every(isFinitePointTuple)) {
|
|
195
|
+
return '';
|
|
196
|
+
}
|
|
197
|
+
// i 始终指向下一个尚未写入路径的点:首点只生成 M,单点路径到此结束;
|
|
198
|
+
// 两点生成直线,三个及以上的点才为中间拐点计算圆角。
|
|
186
199
|
var i = 0;
|
|
187
|
-
var d =
|
|
200
|
+
var d = "M".concat(points[i][0], " ").concat(points[i++][1]);
|
|
201
|
+
if (points.length === 1) {
|
|
202
|
+
return d;
|
|
203
|
+
}
|
|
188
204
|
if (points.length === 2) {
|
|
189
|
-
d += "
|
|
205
|
+
d += " L ".concat(points[i][0], " ").concat(points[i][1]);
|
|
190
206
|
}
|
|
191
207
|
else {
|
|
192
|
-
d += "M".concat(points[i][0], " ").concat(points[i++][1]);
|
|
193
208
|
for (; i + 1 < points.length;) {
|
|
194
209
|
var prev = points[i - 1];
|
|
195
210
|
var cur = points[i];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logicflow/extension",
|
|
3
|
-
"version": "2.3.0",
|
|
3
|
+
"version": "2.3.1-alpha.0",
|
|
4
4
|
"description": "LogicFlow Extensions",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"author": "Logicflow-Team",
|
|
21
21
|
"license": "Apache-2.0",
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@logicflow/core": "2.2.
|
|
23
|
+
"@logicflow/core": "^2.2.5-alpha.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@antv/hierarchy": "^0.6.11",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"postcss-url": "^10.1.3",
|
|
38
38
|
"postcss-import": "^16.1.0",
|
|
39
39
|
"rollup-plugin-postcss": "^4.0.2",
|
|
40
|
-
"@logicflow/core": "2.2.
|
|
40
|
+
"@logicflow/core": "2.2.5-alpha.0"
|
|
41
41
|
},
|
|
42
42
|
"files": [
|
|
43
43
|
"dist",
|