@logicflow/extension 1.1.27 → 1.1.29
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.
- package/cjs/NodeResize/Control/Control.js +37 -9
- package/cjs/NodeResize/Node/DiamondResize.js +5 -2
- package/cjs/NodeResize/Node/EllipseResize.js +5 -2
- package/cjs/NodeResize/Node/HtmlResize.js +5 -2
- package/cjs/NodeResize/Node/RectResize.js +5 -2
- package/cjs/materials/curved-edge/index.js +47 -40
- package/cjs/turbo-adapter/index.js +4 -6
- package/es/NodeResize/Control/Control.d.ts +4 -0
- package/es/NodeResize/Control/Control.js +37 -9
- package/es/NodeResize/Node/DiamondResize.js +5 -2
- package/es/NodeResize/Node/EllipseResize.js +5 -2
- package/es/NodeResize/Node/HtmlResize.js +5 -2
- package/es/NodeResize/Node/RectResize.js +5 -2
- package/es/materials/curved-edge/index.d.ts +7 -6
- package/es/materials/curved-edge/index.js +47 -39
- package/es/turbo-adapter/index.js +4 -6
- package/lib/AutoLayout.js +1 -1
- package/lib/BpmnAdapter.js +1 -1
- package/lib/BpmnElement.js +1 -1
- package/lib/ContextMenu.js +1 -1
- package/lib/Control.js +1 -1
- package/lib/CurvedEdge.js +1 -1
- package/lib/DndPanel.js +1 -1
- package/lib/FlowPath.js +1 -1
- package/lib/Group.js +1 -1
- package/lib/Highlight.js +1 -1
- package/lib/InsertNodeInPolyline.js +1 -1
- package/lib/Menu.js +1 -1
- package/lib/MiniMap.js +1 -1
- package/lib/NodeResize.js +1 -1
- package/lib/RectLabelNode.js +1 -1
- package/lib/SelectionSelect.js +1 -1
- package/lib/Snapshot.js +1 -1
- package/lib/TurboAdapter.js +1 -1
- package/lib/lfJson2Xml.js +1 -1
- package/lib/lfXml2Json.js +1 -1
- package/package.json +2 -2
- package/types/NodeResize/Control/Control.d.ts +4 -0
- package/types/materials/curved-edge/index.d.ts +7 -6
|
@@ -23,6 +23,22 @@ var __assign = (this && this.__assign) || function () {
|
|
|
23
23
|
};
|
|
24
24
|
return __assign.apply(this, arguments);
|
|
25
25
|
};
|
|
26
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
27
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
28
|
+
if (!m) return o;
|
|
29
|
+
var i = m.call(o), r, ar = [], e;
|
|
30
|
+
try {
|
|
31
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
32
|
+
}
|
|
33
|
+
catch (error) { e = { error: error }; }
|
|
34
|
+
finally {
|
|
35
|
+
try {
|
|
36
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
37
|
+
}
|
|
38
|
+
finally { if (e) throw e.error; }
|
|
39
|
+
}
|
|
40
|
+
return ar;
|
|
41
|
+
};
|
|
26
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
43
|
var preact_1 = require("preact");
|
|
28
44
|
var core_1 = require("@logicflow/core");
|
|
@@ -271,8 +287,11 @@ var Control = /** @class */ (function (_super) {
|
|
|
271
287
|
_this.graphModel.eventCenter.emit('node:resize', { oldNodeSize: oldNodeSize, newNodeSize: newNodeSize });
|
|
272
288
|
};
|
|
273
289
|
_this.onDraging = function (_a) {
|
|
290
|
+
var _b;
|
|
274
291
|
var deltaX = _a.deltaX, deltaY = _a.deltaY;
|
|
292
|
+
var transformModel = _this.graphModel.transformModel;
|
|
275
293
|
var modelType = _this.nodeModel.modelType;
|
|
294
|
+
_b = __read(transformModel.fixDeltaXY(deltaX, deltaY), 2), deltaX = _b[0], deltaY = _b[1];
|
|
276
295
|
// html和矩形的计算方式是一样的,共用一个方法
|
|
277
296
|
if (modelType === Util_1.ModelType.RECT_NODE || modelType === Util_1.ModelType.HTML_NODE) {
|
|
278
297
|
_this.updateRect({ deltaX: deltaX, deltaY: deltaY });
|
|
@@ -285,23 +304,32 @@ var Control = /** @class */ (function (_super) {
|
|
|
285
304
|
_this.updateDiamond({ deltaX: deltaX, deltaY: deltaY });
|
|
286
305
|
}
|
|
287
306
|
};
|
|
307
|
+
/**
|
|
308
|
+
* 由于将拖拽放大缩小改成丝滑模式,这个时候需要在拖拽结束的时候,将节点的位置更新到grid上.
|
|
309
|
+
*/
|
|
310
|
+
_this.onDragEnd = function () {
|
|
311
|
+
var _a = _this.graphModel.gridSize, gridSize = _a === void 0 ? 1 : _a;
|
|
312
|
+
var x = gridSize * Math.round(_this.nodeModel.x / gridSize);
|
|
313
|
+
var y = gridSize * Math.round(_this.nodeModel.y / gridSize);
|
|
314
|
+
_this.nodeModel.moveTo(x, y);
|
|
315
|
+
};
|
|
288
316
|
_this.index = props.index;
|
|
289
317
|
_this.nodeModel = props.model;
|
|
290
318
|
_this.graphModel = props.graphModel;
|
|
291
|
-
var gridSize = _this.graphModel.gridSize;
|
|
292
319
|
// 为保证对齐线功能正常使用,step默认是网格grid的两倍,
|
|
293
320
|
// 没有网格设置,默认为2,保证坐标是整数
|
|
294
|
-
|
|
295
|
-
if (gridSize > 1) {
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
if (
|
|
299
|
-
|
|
300
|
-
}
|
|
321
|
+
// let step = 2;
|
|
322
|
+
// if (gridSize > 1) {
|
|
323
|
+
// step = 2 * gridSize;
|
|
324
|
+
// }
|
|
325
|
+
// if (this.nodeModel.gridSize) {
|
|
326
|
+
// step = 2 * this.nodeModel.gridSize;
|
|
327
|
+
// }
|
|
301
328
|
_this.state = {};
|
|
302
329
|
_this.dragHandler = new StepDrag({
|
|
303
330
|
onDraging: _this.onDraging,
|
|
304
|
-
|
|
331
|
+
onDragEnd: _this.onDragEnd,
|
|
332
|
+
step: 1,
|
|
305
333
|
});
|
|
306
334
|
return _this;
|
|
307
335
|
}
|
|
@@ -48,6 +48,9 @@ var DiamondResizeModel = /** @class */ (function (_super) {
|
|
|
48
48
|
};
|
|
49
49
|
DiamondResizeModel.prototype.getOutlineStyle = function () {
|
|
50
50
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
51
|
+
var isSilentMode = this.graphModel.editConfigModel.isSilentMode;
|
|
52
|
+
if (isSilentMode)
|
|
53
|
+
return style;
|
|
51
54
|
style.stroke = 'none';
|
|
52
55
|
if (style.hover) {
|
|
53
56
|
style.hover.stroke = 'none';
|
|
@@ -89,10 +92,10 @@ var DiamondResizeView = /** @class */ (function (_super) {
|
|
|
89
92
|
core_1.h(Polygon_1.default, __assign({}, style, { points: points }))));
|
|
90
93
|
};
|
|
91
94
|
DiamondResizeView.prototype.getShape = function () {
|
|
92
|
-
var
|
|
95
|
+
var _a = this.props, isSelected = _a.model.isSelected, isSilentMode = _a.graphModel.editConfigModel.isSilentMode;
|
|
93
96
|
return (core_1.h("g", null,
|
|
94
97
|
this.getResizeShape(),
|
|
95
|
-
isSelected ? this.getControlGroup() : ''));
|
|
98
|
+
isSelected && !isSilentMode ? this.getControlGroup() : ''));
|
|
96
99
|
};
|
|
97
100
|
return DiamondResizeView;
|
|
98
101
|
}(core_1.DiamondNode));
|
|
@@ -35,6 +35,9 @@ var EllipseResizeModel = /** @class */ (function (_super) {
|
|
|
35
35
|
};
|
|
36
36
|
EllipseResizeModel.prototype.getOutlineStyle = function () {
|
|
37
37
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
38
|
+
var isSilentMode = this.graphModel.editConfigModel.isSilentMode;
|
|
39
|
+
if (isSilentMode)
|
|
40
|
+
return style;
|
|
38
41
|
style.stroke = 'none';
|
|
39
42
|
if (style.hover) {
|
|
40
43
|
style.hover.stroke = 'none';
|
|
@@ -72,10 +75,10 @@ var EllipseResizeView = /** @class */ (function (_super) {
|
|
|
72
75
|
return _super.prototype.getShape.call(this);
|
|
73
76
|
};
|
|
74
77
|
EllipseResizeView.prototype.getShape = function () {
|
|
75
|
-
var
|
|
78
|
+
var _a = this.props, model = _a.model, isSilentMode = _a.graphModel.editConfigModel.isSilentMode;
|
|
76
79
|
return (core_1.h("g", null,
|
|
77
80
|
this.getResizeShape(),
|
|
78
|
-
model.isSelected ? this.getControlGroup() : ''));
|
|
81
|
+
model.isSelected && !isSilentMode ? this.getControlGroup() : ''));
|
|
79
82
|
};
|
|
80
83
|
return EllipseResizeView;
|
|
81
84
|
}(core_1.EllipseNode));
|
|
@@ -35,6 +35,9 @@ var HtmlResizeModel = /** @class */ (function (_super) {
|
|
|
35
35
|
};
|
|
36
36
|
HtmlResizeModel.prototype.getOutlineStyle = function () {
|
|
37
37
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
38
|
+
var isSilentMode = this.graphModel.editConfigModel.isSilentMode;
|
|
39
|
+
if (isSilentMode)
|
|
40
|
+
return style;
|
|
38
41
|
style.stroke = 'none';
|
|
39
42
|
if (style.hover) {
|
|
40
43
|
style.hover.stroke = 'none';
|
|
@@ -72,10 +75,10 @@ var HtmlResizeView = /** @class */ (function (_super) {
|
|
|
72
75
|
return _super.prototype.getShape.call(this);
|
|
73
76
|
};
|
|
74
77
|
HtmlResizeView.prototype.getShape = function () {
|
|
75
|
-
var
|
|
78
|
+
var _a = this.props, isSelected = _a.model.isSelected, isSilentMode = _a.graphModel.editConfigModel.isSilentMode;
|
|
76
79
|
return (core_1.h("g", null,
|
|
77
80
|
this.getResizeShape(),
|
|
78
|
-
isSelected ? this.getControlGroup() : ''));
|
|
81
|
+
isSelected && !isSilentMode ? this.getControlGroup() : ''));
|
|
79
82
|
};
|
|
80
83
|
return HtmlResizeView;
|
|
81
84
|
}(core_1.HtmlNode));
|
|
@@ -35,6 +35,9 @@ var RectResizeModel = /** @class */ (function (_super) {
|
|
|
35
35
|
};
|
|
36
36
|
RectResizeModel.prototype.getOutlineStyle = function () {
|
|
37
37
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
38
|
+
var isSilentMode = this.graphModel.editConfigModel.isSilentMode;
|
|
39
|
+
if (isSilentMode)
|
|
40
|
+
return style;
|
|
38
41
|
style.stroke = 'none';
|
|
39
42
|
if (style.hover) {
|
|
40
43
|
style.hover.stroke = 'none';
|
|
@@ -76,10 +79,10 @@ var RectResizeView = /** @class */ (function (_super) {
|
|
|
76
79
|
return _super.prototype.getShape.call(this);
|
|
77
80
|
};
|
|
78
81
|
RectResizeView.prototype.getShape = function () {
|
|
79
|
-
var
|
|
82
|
+
var _a = this.props, isSelected = _a.model.isSelected, isSilentMode = _a.graphModel.editConfigModel.isSilentMode;
|
|
80
83
|
return (core_1.h("g", null,
|
|
81
84
|
this.getResizeShape(),
|
|
82
|
-
isSelected ? this.getControlGroup() : ''));
|
|
85
|
+
isSelected && !isSilentMode ? this.getControlGroup() : ''));
|
|
83
86
|
};
|
|
84
87
|
return RectResizeView;
|
|
85
88
|
}(core_1.RectNode));
|
|
@@ -12,6 +12,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
13
|
};
|
|
14
14
|
})();
|
|
15
|
+
var __assign = (this && this.__assign) || function () {
|
|
16
|
+
__assign = Object.assign || function(t) {
|
|
17
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
+
s = arguments[i];
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
15
26
|
var __read = (this && this.__read) || function (o, n) {
|
|
16
27
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
17
28
|
if (!m) return o;
|
|
@@ -29,17 +40,36 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
29
40
|
return ar;
|
|
30
41
|
};
|
|
31
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.CurvedEdge = void 0;
|
|
43
|
+
exports.CurvedEdgeModel = exports.CurvedEdge = void 0;
|
|
33
44
|
var core_1 = require("@logicflow/core");
|
|
34
|
-
var
|
|
35
|
-
__extends(
|
|
36
|
-
function
|
|
45
|
+
var CurvedEdge = /** @class */ (function (_super) {
|
|
46
|
+
__extends(CurvedEdge, _super);
|
|
47
|
+
function CurvedEdge() {
|
|
37
48
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
38
49
|
}
|
|
39
|
-
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
|
|
50
|
+
CurvedEdge.prototype.pointFilter = function (points) {
|
|
51
|
+
var allPoints = points;
|
|
52
|
+
var i = 1;
|
|
53
|
+
while (i < allPoints.length - 1) {
|
|
54
|
+
var _a = __read(allPoints[i - 1], 2), x = _a[0], y = _a[1];
|
|
55
|
+
var _b = __read(allPoints[i], 2), x1 = _b[0], y1 = _b[1];
|
|
56
|
+
var _c = __read(allPoints[i + 1], 2), x2 = _c[0], y2 = _c[1];
|
|
57
|
+
if ((x === x1 && x1 === x2)
|
|
58
|
+
|| (y === y1 && y1 === y2)) {
|
|
59
|
+
allPoints.splice(i, 1);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
i++;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return allPoints;
|
|
66
|
+
};
|
|
67
|
+
CurvedEdge.prototype.getEdge = function () {
|
|
68
|
+
var model = this.props.model;
|
|
69
|
+
var points = model.points, isAnimation = model.isAnimation, arrowConfig = model.arrowConfig, _a = model.radius, radius = _a === void 0 ? 5 : _a;
|
|
70
|
+
var style = model.getEdgeStyle();
|
|
71
|
+
var animationStyle = model.getEdgeAnimationStyle();
|
|
72
|
+
var points2 = this.pointFilter(points.split(' ').map(function (p) { return p.split(',').map(function (a) { return Number(a); }); }));
|
|
43
73
|
var _b = __read(points2[0], 2), startX = _b[0], startY = _b[1];
|
|
44
74
|
var d = "M" + startX + " " + startY;
|
|
45
75
|
// 1) 如果一个点不为开始和结束,则在这个点的前后增加弧度开始和结束点。
|
|
@@ -47,43 +77,36 @@ var CurvedEdgeView = /** @class */ (function (_super) {
|
|
|
47
77
|
// 如果x相同则前一个点的x也不变,
|
|
48
78
|
// y为(这个点的y 大于前一个点的y, 则 为 这个点的y - 5;小于前一个点的y, 则为这个点的y+5)
|
|
49
79
|
// 同理,判断这个点与后一个点的x,y是否相同,如果x相同,则y进行加减,如果y相同,则x进行加减
|
|
50
|
-
// todo: 好丑,看看怎么优化下
|
|
51
|
-
var space = 5;
|
|
52
80
|
for (var i = 1; i < points2.length - 1; i++) {
|
|
53
81
|
var _c = __read(points2[i - 1], 2), preX = _c[0], preY = _c[1];
|
|
54
82
|
var _d = __read(points2[i], 2), currentX = _d[0], currentY = _d[1];
|
|
55
83
|
var _e = __read(points2[i + 1], 2), nextX = _e[0], nextY = _e[1];
|
|
56
84
|
if (currentX === preX && currentY !== preY) {
|
|
57
|
-
var y = currentY > preY ? currentY -
|
|
85
|
+
var y = currentY > preY ? currentY - radius : currentY + radius;
|
|
58
86
|
d = d + " L " + currentX + " " + y;
|
|
59
87
|
}
|
|
60
88
|
if (currentY === preY && currentX !== preX) {
|
|
61
|
-
var x = currentX > preX ? currentX -
|
|
89
|
+
var x = currentX > preX ? currentX - radius : currentX + radius;
|
|
62
90
|
d = d + " L " + x + " " + currentY;
|
|
63
91
|
}
|
|
64
92
|
d = d + " Q " + currentX + " " + currentY;
|
|
65
93
|
if (currentX === nextX && currentY !== nextY) {
|
|
66
|
-
var y = currentY > nextY ? currentY -
|
|
94
|
+
var y = currentY > nextY ? currentY - radius : currentY + radius;
|
|
67
95
|
d = d + " " + currentX + " " + y;
|
|
68
96
|
}
|
|
69
97
|
if (currentY === nextY && currentX !== nextX) {
|
|
70
|
-
var x = currentX > nextX ? currentX -
|
|
98
|
+
var x = currentX > nextX ? currentX - radius : currentX + radius;
|
|
71
99
|
d = d + " " + x + " " + currentY;
|
|
72
100
|
}
|
|
73
101
|
}
|
|
74
102
|
var _f = __read(points2[points2.length - 1], 2), endX = _f[0], endY = _f[1];
|
|
75
103
|
d = d + " L " + endX + " " + endY;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
strokeWidth: strokeWidth,
|
|
79
|
-
stroke: stroke,
|
|
80
|
-
fill: 'none',
|
|
81
|
-
strokeDashArray: strokeDashArray,
|
|
82
|
-
});
|
|
104
|
+
var attrs = __assign(__assign(__assign({ d: d, style: isAnimation ? animationStyle : {} }, style), arrowConfig), { fill: 'none' });
|
|
105
|
+
return core_1.h('path', __assign({ d: d }, attrs));
|
|
83
106
|
};
|
|
84
|
-
|
|
85
|
-
return CurvedEdgeView;
|
|
107
|
+
return CurvedEdge;
|
|
86
108
|
}(core_1.PolylineEdge));
|
|
109
|
+
exports.CurvedEdge = CurvedEdge;
|
|
87
110
|
var CurvedEdgeModel = /** @class */ (function (_super) {
|
|
88
111
|
__extends(CurvedEdgeModel, _super);
|
|
89
112
|
function CurvedEdgeModel() {
|
|
@@ -91,20 +114,4 @@ var CurvedEdgeModel = /** @class */ (function (_super) {
|
|
|
91
114
|
}
|
|
92
115
|
return CurvedEdgeModel;
|
|
93
116
|
}(core_1.PolylineEdgeModel));
|
|
94
|
-
|
|
95
|
-
pluginName: 'curved-edge',
|
|
96
|
-
curvedSpace: 5,
|
|
97
|
-
init: function (_a) {
|
|
98
|
-
var curvedSpace = _a.curvedSpace;
|
|
99
|
-
CurvedEdge.curvedSpace = curvedSpace;
|
|
100
|
-
},
|
|
101
|
-
install: function (lf) {
|
|
102
|
-
lf.register({
|
|
103
|
-
type: 'curved-edge',
|
|
104
|
-
view: CurvedEdgeView,
|
|
105
|
-
model: CurvedEdgeModel,
|
|
106
|
-
});
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
exports.CurvedEdge = CurvedEdge;
|
|
110
|
-
exports.default = CurvedEdge;
|
|
117
|
+
exports.CurvedEdgeModel = CurvedEdgeModel;
|
|
@@ -84,7 +84,7 @@ function convertEdgeToTurboElement(edge) {
|
|
|
84
84
|
outgoing: [targetNodeId],
|
|
85
85
|
type: getTurboType(type),
|
|
86
86
|
dockers: [],
|
|
87
|
-
properties: __assign(__assign({}, properties), { name: (text && text.value) || '', text: text, startPoint: JSON.stringify(startPoint), endPoint: JSON.stringify(endPoint), pointsList: JSON.stringify(
|
|
87
|
+
properties: __assign(__assign({}, properties), { name: (text && text.value) || '', text: text, startPoint: JSON.stringify(startPoint), endPoint: JSON.stringify(endPoint), pointsList: JSON.stringify(pointsList) }),
|
|
88
88
|
key: id,
|
|
89
89
|
};
|
|
90
90
|
}
|
|
@@ -123,16 +123,13 @@ function convertFlowElementToEdge(element) {
|
|
|
123
123
|
properties: {},
|
|
124
124
|
};
|
|
125
125
|
if (startPoint) {
|
|
126
|
-
// @ts-ignore
|
|
127
126
|
edge.startPoint = JSON.parse(startPoint);
|
|
128
127
|
}
|
|
129
128
|
if (endPoint) {
|
|
130
|
-
// @ts-ignore
|
|
131
129
|
edge.endPoint = JSON.parse(endPoint);
|
|
132
130
|
}
|
|
133
131
|
if (pointsList) {
|
|
134
|
-
|
|
135
|
-
edge.endPoint = JSON.parse(pointsList);
|
|
132
|
+
edge.pointsList = JSON.parse(pointsList);
|
|
136
133
|
}
|
|
137
134
|
// 这种转换方式,在自定义属性中不能与excludeProperties中的属性重名,否则将在转换过程中丢失
|
|
138
135
|
var excludeProperties = ['startPoint', 'endPoint', 'pointsList', 'text'];
|
|
@@ -147,6 +144,7 @@ function convertFlowElementToEdge(element) {
|
|
|
147
144
|
function convertFlowElementToNode(element) {
|
|
148
145
|
var properties = element.properties, key = element.key, type = element.type, bounds = element.bounds;
|
|
149
146
|
var x = properties.x, y = properties.y;
|
|
147
|
+
var text = properties.text;
|
|
150
148
|
if (x === undefined) {
|
|
151
149
|
var _a = __read(bounds, 2), _b = _a[0], x1 = _b.x, y1 = _b.y, _c = _a[1], x2 = _c.x, y2 = _c.y;
|
|
152
150
|
x = (x1 + x2) / 2;
|
|
@@ -157,7 +155,7 @@ function convertFlowElementToNode(element) {
|
|
|
157
155
|
type: TurboTypeMap[type],
|
|
158
156
|
x: x,
|
|
159
157
|
y: y,
|
|
160
|
-
text:
|
|
158
|
+
text: text,
|
|
161
159
|
properties: {},
|
|
162
160
|
};
|
|
163
161
|
// 这种转换方式,在自定义属性中不能与excludeProperties中的属性重名,否则将在转换过程中丢失
|
|
@@ -22,6 +22,22 @@ var __assign = (this && this.__assign) || function () {
|
|
|
22
22
|
};
|
|
23
23
|
return __assign.apply(this, arguments);
|
|
24
24
|
};
|
|
25
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
26
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
27
|
+
if (!m) return o;
|
|
28
|
+
var i = m.call(o), r, ar = [], e;
|
|
29
|
+
try {
|
|
30
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
31
|
+
}
|
|
32
|
+
catch (error) { e = { error: error }; }
|
|
33
|
+
finally {
|
|
34
|
+
try {
|
|
35
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
36
|
+
}
|
|
37
|
+
finally { if (e) throw e.error; }
|
|
38
|
+
}
|
|
39
|
+
return ar;
|
|
40
|
+
};
|
|
25
41
|
import { h, Component } from 'preact';
|
|
26
42
|
import { LogicFlowUtil } from '@logicflow/core';
|
|
27
43
|
import Rect from '../BasicShape/Rect';
|
|
@@ -269,8 +285,11 @@ var Control = /** @class */ (function (_super) {
|
|
|
269
285
|
_this.graphModel.eventCenter.emit('node:resize', { oldNodeSize: oldNodeSize, newNodeSize: newNodeSize });
|
|
270
286
|
};
|
|
271
287
|
_this.onDraging = function (_a) {
|
|
288
|
+
var _b;
|
|
272
289
|
var deltaX = _a.deltaX, deltaY = _a.deltaY;
|
|
290
|
+
var transformModel = _this.graphModel.transformModel;
|
|
273
291
|
var modelType = _this.nodeModel.modelType;
|
|
292
|
+
_b = __read(transformModel.fixDeltaXY(deltaX, deltaY), 2), deltaX = _b[0], deltaY = _b[1];
|
|
274
293
|
// html和矩形的计算方式是一样的,共用一个方法
|
|
275
294
|
if (modelType === ModelType.RECT_NODE || modelType === ModelType.HTML_NODE) {
|
|
276
295
|
_this.updateRect({ deltaX: deltaX, deltaY: deltaY });
|
|
@@ -283,23 +302,32 @@ var Control = /** @class */ (function (_super) {
|
|
|
283
302
|
_this.updateDiamond({ deltaX: deltaX, deltaY: deltaY });
|
|
284
303
|
}
|
|
285
304
|
};
|
|
305
|
+
/**
|
|
306
|
+
* 由于将拖拽放大缩小改成丝滑模式,这个时候需要在拖拽结束的时候,将节点的位置更新到grid上.
|
|
307
|
+
*/
|
|
308
|
+
_this.onDragEnd = function () {
|
|
309
|
+
var _a = _this.graphModel.gridSize, gridSize = _a === void 0 ? 1 : _a;
|
|
310
|
+
var x = gridSize * Math.round(_this.nodeModel.x / gridSize);
|
|
311
|
+
var y = gridSize * Math.round(_this.nodeModel.y / gridSize);
|
|
312
|
+
_this.nodeModel.moveTo(x, y);
|
|
313
|
+
};
|
|
286
314
|
_this.index = props.index;
|
|
287
315
|
_this.nodeModel = props.model;
|
|
288
316
|
_this.graphModel = props.graphModel;
|
|
289
|
-
var gridSize = _this.graphModel.gridSize;
|
|
290
317
|
// 为保证对齐线功能正常使用,step默认是网格grid的两倍,
|
|
291
318
|
// 没有网格设置,默认为2,保证坐标是整数
|
|
292
|
-
|
|
293
|
-
if (gridSize > 1) {
|
|
294
|
-
|
|
295
|
-
}
|
|
296
|
-
if (
|
|
297
|
-
|
|
298
|
-
}
|
|
319
|
+
// let step = 2;
|
|
320
|
+
// if (gridSize > 1) {
|
|
321
|
+
// step = 2 * gridSize;
|
|
322
|
+
// }
|
|
323
|
+
// if (this.nodeModel.gridSize) {
|
|
324
|
+
// step = 2 * this.nodeModel.gridSize;
|
|
325
|
+
// }
|
|
299
326
|
_this.state = {};
|
|
300
327
|
_this.dragHandler = new StepDrag({
|
|
301
328
|
onDraging: _this.onDraging,
|
|
302
|
-
|
|
329
|
+
onDragEnd: _this.onDragEnd,
|
|
330
|
+
step: 1,
|
|
303
331
|
});
|
|
304
332
|
return _this;
|
|
305
333
|
}
|
|
@@ -46,6 +46,9 @@ var DiamondResizeModel = /** @class */ (function (_super) {
|
|
|
46
46
|
};
|
|
47
47
|
DiamondResizeModel.prototype.getOutlineStyle = function () {
|
|
48
48
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
49
|
+
var isSilentMode = this.graphModel.editConfigModel.isSilentMode;
|
|
50
|
+
if (isSilentMode)
|
|
51
|
+
return style;
|
|
49
52
|
style.stroke = 'none';
|
|
50
53
|
if (style.hover) {
|
|
51
54
|
style.hover.stroke = 'none';
|
|
@@ -87,10 +90,10 @@ var DiamondResizeView = /** @class */ (function (_super) {
|
|
|
87
90
|
h(Polygon, __assign({}, style, { points: points }))));
|
|
88
91
|
};
|
|
89
92
|
DiamondResizeView.prototype.getShape = function () {
|
|
90
|
-
var
|
|
93
|
+
var _a = this.props, isSelected = _a.model.isSelected, isSilentMode = _a.graphModel.editConfigModel.isSilentMode;
|
|
91
94
|
return (h("g", null,
|
|
92
95
|
this.getResizeShape(),
|
|
93
|
-
isSelected ? this.getControlGroup() : ''));
|
|
96
|
+
isSelected && !isSilentMode ? this.getControlGroup() : ''));
|
|
94
97
|
};
|
|
95
98
|
return DiamondResizeView;
|
|
96
99
|
}(DiamondNode));
|
|
@@ -33,6 +33,9 @@ var EllipseResizeModel = /** @class */ (function (_super) {
|
|
|
33
33
|
};
|
|
34
34
|
EllipseResizeModel.prototype.getOutlineStyle = function () {
|
|
35
35
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
36
|
+
var isSilentMode = this.graphModel.editConfigModel.isSilentMode;
|
|
37
|
+
if (isSilentMode)
|
|
38
|
+
return style;
|
|
36
39
|
style.stroke = 'none';
|
|
37
40
|
if (style.hover) {
|
|
38
41
|
style.hover.stroke = 'none';
|
|
@@ -70,10 +73,10 @@ var EllipseResizeView = /** @class */ (function (_super) {
|
|
|
70
73
|
return _super.prototype.getShape.call(this);
|
|
71
74
|
};
|
|
72
75
|
EllipseResizeView.prototype.getShape = function () {
|
|
73
|
-
var
|
|
76
|
+
var _a = this.props, model = _a.model, isSilentMode = _a.graphModel.editConfigModel.isSilentMode;
|
|
74
77
|
return (h("g", null,
|
|
75
78
|
this.getResizeShape(),
|
|
76
|
-
model.isSelected ? this.getControlGroup() : ''));
|
|
79
|
+
model.isSelected && !isSilentMode ? this.getControlGroup() : ''));
|
|
77
80
|
};
|
|
78
81
|
return EllipseResizeView;
|
|
79
82
|
}(EllipseNode));
|
|
@@ -33,6 +33,9 @@ var HtmlResizeModel = /** @class */ (function (_super) {
|
|
|
33
33
|
};
|
|
34
34
|
HtmlResizeModel.prototype.getOutlineStyle = function () {
|
|
35
35
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
36
|
+
var isSilentMode = this.graphModel.editConfigModel.isSilentMode;
|
|
37
|
+
if (isSilentMode)
|
|
38
|
+
return style;
|
|
36
39
|
style.stroke = 'none';
|
|
37
40
|
if (style.hover) {
|
|
38
41
|
style.hover.stroke = 'none';
|
|
@@ -70,10 +73,10 @@ var HtmlResizeView = /** @class */ (function (_super) {
|
|
|
70
73
|
return _super.prototype.getShape.call(this);
|
|
71
74
|
};
|
|
72
75
|
HtmlResizeView.prototype.getShape = function () {
|
|
73
|
-
var
|
|
76
|
+
var _a = this.props, isSelected = _a.model.isSelected, isSilentMode = _a.graphModel.editConfigModel.isSilentMode;
|
|
74
77
|
return (h("g", null,
|
|
75
78
|
this.getResizeShape(),
|
|
76
|
-
isSelected ? this.getControlGroup() : ''));
|
|
79
|
+
isSelected && !isSilentMode ? this.getControlGroup() : ''));
|
|
77
80
|
};
|
|
78
81
|
return HtmlResizeView;
|
|
79
82
|
}(HtmlNode));
|
|
@@ -33,6 +33,9 @@ var RectResizeModel = /** @class */ (function (_super) {
|
|
|
33
33
|
};
|
|
34
34
|
RectResizeModel.prototype.getOutlineStyle = function () {
|
|
35
35
|
var style = _super.prototype.getOutlineStyle.call(this);
|
|
36
|
+
var isSilentMode = this.graphModel.editConfigModel.isSilentMode;
|
|
37
|
+
if (isSilentMode)
|
|
38
|
+
return style;
|
|
36
39
|
style.stroke = 'none';
|
|
37
40
|
if (style.hover) {
|
|
38
41
|
style.hover.stroke = 'none';
|
|
@@ -74,10 +77,10 @@ var RectResizeView = /** @class */ (function (_super) {
|
|
|
74
77
|
return _super.prototype.getShape.call(this);
|
|
75
78
|
};
|
|
76
79
|
RectResizeView.prototype.getShape = function () {
|
|
77
|
-
var
|
|
80
|
+
var _a = this.props, isSelected = _a.model.isSelected, isSilentMode = _a.graphModel.editConfigModel.isSilentMode;
|
|
78
81
|
return (h("g", null,
|
|
79
82
|
this.getResizeShape(),
|
|
80
|
-
isSelected ? this.getControlGroup() : ''));
|
|
83
|
+
isSelected && !isSilentMode ? this.getControlGroup() : ''));
|
|
81
84
|
};
|
|
82
85
|
return RectResizeView;
|
|
83
86
|
}(RectNode));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { PolylineEdge, PolylineEdgeModel } from '@logicflow/core';
|
|
2
|
+
declare class CurvedEdge extends PolylineEdge {
|
|
3
|
+
pointFilter(points: any): any;
|
|
4
|
+
getEdge(): import("preact").VNode<any>;
|
|
4
5
|
}
|
|
5
|
-
declare
|
|
6
|
-
|
|
7
|
-
export { CurvedEdge, };
|
|
6
|
+
declare class CurvedEdgeModel extends PolylineEdgeModel {
|
|
7
|
+
}
|
|
8
|
+
export { CurvedEdge, CurvedEdgeModel, };
|